메인 컨텐츠로 가기

Excel의 여러 열에서 고유 값을 추출하는 방법은 무엇입니까?

여러 값이있는 여러 열이 있다고 가정하면 일부 값이 동일한 열 또는 다른 열에서 반복됩니다. 이제 한 열에 한 번만 존재하는 값을 찾고 싶습니다. Excel의 여러 열에서 고유 값을 추출하는 빠른 트릭이 있습니까?


수식을 사용하여 여러 열에서 고유한 값 추출

이 섹션에서는 두 가지 수식을 다룹니다. 하나는 모든 Excel 버전에 적합한 배열 수식을 사용하고 다른 하나는 Excel 365용 동적 배열 수식을 사용합니다.

모든 Excel 버전에 대한 배열 수식을 사용하여 여러 열에서 고유 값 추출

모든 버전의 Excel을 사용하는 사용자에게 배열 수식은 여러 열에서 고유한 값을 추출하는 강력한 도구가 될 수 있습니다. 방법은 다음과 같습니다.

1. 범위 내 값 가정 A2 : C9, E2 셀에 다음 수식을 입력하십시오.

=INDIRECT(TEXT(MIN(IF(($A$2:$C$9<>"")*(COUNTIF($E$1:E1,$A$2:$C$9)=0),ROW($2:$9)*100+COLUMN($A:$C),7^8)),"R0C00"),)&""
주의 사항: 위의 공식에서 A2 : C9 고유 값을 추출하려는 셀 범위를 나타냅니다. E1 : E1 결과를 배치하려는 열의 첫 번째 셀입니다. $ 2 : $ 9 사용하려는 셀이있는 행에 서서 $ A : $ C 사용하려는 셀이 열에 포함되어 있음을 나타냅니다. 자신의 것으로 변경하십시오.

2. 그런 다음 쉬프트 + 컨트롤 + 엔터 키를 함께 누른 다음 채우기 핸들을 끌어 빈 셀이 나타날 때까지 고유 한 값을 추출합니다. 스크린 샷보기 :

이 공식의 설명:
  1. $ A $ 2 : $ C $ 9: 확인할 데이터 범위를 지정하는데, A2부터 C9까지의 셀입니다.
  2. IF(($A$2:$C$9<>"")*(COUNTIF($E$1:E1,$A$2:$C$9)=0), ROW($2:$9)*100+COLUMN($A:$C), 7^8):
    • $A$2:$C$9<>"" 범위의 셀이 비어 있지 않은지 확인합니다.
    • COUNTIF($E$1:E1,$A$2:$C$9)=0 이 셀의 값이 E1에서 E1까지의 셀 범위에 아직 나열되지 않았는지 확인합니다.
    • 두 조건이 모두 충족되는 경우(즉, 값이 비어 있지 않고 아직 E 열에 나열되지 않은 경우) IF 함수는 행과 열(ROW($2:$9)*100+COLUMN($A:)을 기반으로 고유한 숫자를 계산합니다. $C)).
    • 조건이 충족되지 않으면 함수는 자리 표시자 역할을 하는 큰 숫자(7^8)를 반환합니다.
  3. 분(...): 다음 고유 값의 위치에 해당하는 위의 IF 함수에서 반환된 가장 작은 숫자를 찾습니다.
  4. TEXT(...,"R0C00"): 이 최소 숫자를 R1C1 스타일 주소로 변환합니다. 형식 코드 R0C00은 숫자를 Excel 셀 참조 형식으로 변환함을 나타냅니다.
  5. 간접(...): INDIRECT 함수를 사용하여 이전 단계에서 생성된 R1C1 스타일 주소를 일반 A1 스타일 셀 참조로 다시 변환합니다. INDIRECT 함수를 사용하면 텍스트 문자열의 내용을 기반으로 셀 참조를 수행할 수 있습니다.
  6. &"": 수식 끝에 &""를 추가하면 최종 출력이 텍스트로 처리되므로 짝수도 텍스트로 표시됩니다.
 
Excel 365용 수식을 사용하여 여러 열에서 고유한 값을 추출합니다.

Excel 365는 동적 배열을 지원하므로 여러 열에서 고유한 값을 훨씬 쉽게 추출할 수 있습니다.

결과를 입력할 빈 셀에 다음 수식을 입력하거나 복사한 후 다음을 클릭하세요. 엔터 버튼 모든 고유 값을 한 번에 가져오는 키입니다. 스크린샷 보기:

=UNIQUE(TOCOL(A2:C9,1))


Kutools AI Aide를 사용하여 여러 열에서 고유한 값을 추출합니다.

의 힘을 최대한 발휘 Kutools AI 보좌관 Excel의 여러 열에서 고유한 값을 원활하게 추출합니다. 몇 번의 클릭만으로 이 지능형 도구는 데이터를 선별하여 선택한 범위 전체에서 고유한 항목을 식별하고 나열합니다. 복잡한 수식이나 vba 코드의 번거로움을 잊고 Kutools AI 보좌관 Excel 워크플로를 보다 생산적이고 오류 없는 환경으로 전환하세요.

주의 사항: 이것을 사용하려면 Kutools AI 보좌관 of Excel 용 Kutools, 제발 Excel 용 Kutools 다운로드 및 설치 먼저.

Excel 용 Kutools를 설치 한 후 Kutools AI > AI 보좌관 를 열려면 Kutools AI 보좌관 창유리:

  1. 채팅 상자에 요구사항을 입력하고 클릭하세요. 전송 버튼을 누르거나 누르십시오. 엔터 버튼 질문을 보내는 키;
    "빈 셀을 무시하고 A2:C9 범위에서 고유한 값을 추출하고 결과를 E2부터 시작합니다."
  2. 분석 후 클릭 실행하다 버튼을 실행합니다. Kutools AI Aide는 AI를 사용하여 요청을 처리하고 Excel에서 직접 지정된 셀의 결과를 반환합니다.


피벗 테이블을 사용하여 여러 열에서 고유 값 추출

피벗 테이블에 익숙하다면 다음 단계를 통해 여러 열에서 고유 한 값을 쉽게 추출 할 수 있습니다.

1. 먼저 데이터 왼쪽에 새 빈 열을 하나 삽입하십시오.이 예에서는 원본 데이터 옆에 A 열을 삽입합니다.

2. 데이터에서 한 셀을 클릭하고 Alt + D 키를 누른 다음 P 열려면 즉시 키 피벗 테이블 및 피벗 차트 마법사선택한다. 다양한 통합 범위 마법사 1 단계에서 스크린 샷을 참조하십시오.

3. 그런 다음 다음 보기 버튼, 확인 나를위한 단일 페이지 필드 만들기 마법사 2 단계의 옵션, 스크린 샷 참조 :

4. 클릭으로 이동 다음 보기 버튼을 클릭하여 왼쪽 새 ​​셀 열을 포함하는 데이터 범위를 선택한 다음 추가 버튼을 눌러 데이터 범위를 모든 범위 목록 상자, 스크린 샷 참조 :

5. 데이터 범위를 선택한 후 계속 클릭 다음 보기, 마법사 3 단계에서 원하는대로 피벗 테이블 보고서를 배치 할 위치를 선택합니다.

6. 마지막으로 마감재 마법사를 완료하고 현재 워크 시트에 피벗 테이블이 생성되었습니다. 보고서에 추가 할 필드 선택 섹션, 스크린 샷 참조 :

7. 그런 다음 필드를 확인하십시오. 가치관 또는 값을 이제 다음과 같이 여러 열에서 고유 한 값을 가져옵니다.


VBA 코드로 여러 열에서 고유 값 추출

다음 VBA 코드를 사용하여 여러 열에서 고유 한 값을 추출 할 수도 있습니다.

1. 누르고 ALT + F11 키가 열립니다. Microsoft Visual Basic for Applications 창.

2. 딸깍 하는 소리 끼워 넣다 > 모듈을 클릭하고 모듈 창에 다음 코드를 붙여 넣습니다.

VBA : 여러 열에서 고유 한 값 추출

Sub Uniquedata()
'Updateby Extendoffice
Dim rng As Range
Dim InputRng As Range, OutRng As Range
Set dt = CreateObject("Scripting.Dictionary")
xTitleId = "KutoolsforExcel"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8)
Set OutRng = Application.InputBox("Out put to (single cell):", xTitleId, Type:=8)
For Each rng In InputRng
    If rng.Value <> "" Then
        dt(rng.Value) = ""
    End If
Next
OutRng.Range("A1").Resize(dt.Count) = Application.WorksheetFunction.Transpose(dt.Keys)
End Sub

3. 그런 다음 F5 이 코드를 실행하면 사용할 데이터 범위를 선택하라는 메시지 상자가 나타납니다. 스크린 샷보기 :

4. 그런 다음 OK, 결과를 넣을 위치를 선택할 수있는 또 다른 프롬프트 상자가 나타납니다. 스크린 샷을 참조하십시오.

5. OK 이 대화 상자를 닫으려면 모든 고유 값이 한 번에 추출되었습니다.


더 많은 관련 기사 :

  • 목록에서 고유하고 고유 한 값의 수 계산
  • 중복 된 항목이있는 긴 값 목록이 있다고 가정 해 보겠습니다. 이제 고유 한 값 (목록에 한 번만 표시되는 값) 또는 고유 한 값 (목록에있는 모든 다른 값은 고유함을 의미 함)의 수를 계산하려고합니다. 왼쪽 스크린 샷과 같이 열에 값 +1 번째 중복 값)이 표시됩니다. 이 기사에서는 Excel 에서이 작업을 처리하는 방법에 대해 설명합니다.
  • Excel의 기준에 따라 고유 한 값 추출
  • 아래 스크린 샷과 같은 결과를 얻기 위해 열 A의 특정 기준에 따라 열 B의 고유 이름 만 나열하려는 다음 데이터 범위가 있다고 가정합니다. Excel에서이 작업을 어떻게 빠르고 쉽게 처리 할 수 ​​있습니까?
  • Excel에서 고유 한 값만 허용
  • 워크 시트 열에 고유 한 값만 입력하고 중복을 방지하려면이 문서에서이 작업을 처리 할 수있는 몇 가지 빠른 트릭을 소개합니다.
  • Excel의 기준에 따라 고유 값 합계
  • 예를 들어 다음 스크린 샷과 같이 Name 열을 기반으로 Order 열의 고유 값만 합산하기 위해 Name 및 Order 열을 포함하는 데이터 범위가 있습니다. Excel에서이 작업을 빠르고 쉽게 해결하는 방법은 무엇입니까?

최고의 사무 생산성 도구

🤖 Kutools AI 보좌관: 다음을 기반으로 데이터 분석을 혁신합니다. 지능형 실행   |  코드 생성  |  사용자 정의 수식 만들기  |  데이터 분석 및 차트 생성  |  Kutools 기능 호출...
인기 기능: 중복 항목 찾기, 강조 표시 또는 식별   |  빈 행 삭제   |  데이터 손실 없이 열이나 셀 결합   |   수식없이 반올림 ...
슈퍼 조회: 다중 기준 VLookup    다중 값 VLookup  |   여러 시트에 걸친 VLookup   |   퍼지 조회 ....
고급 드롭다운 목록: 드롭다운 목록을 빠르게 생성   |  종속 드롭다운 목록   |  다중 선택 드롭 다운 목록 ....
열 관리자: 특정 개수의 열 추가  |  열 이동  |  Toggle 숨겨진 열의 가시성 상태  |  범위 및 열 비교 ...
특색 지어진 특징: 그리드 포커스   |  디자인보기   |   큰 수식 바    통합 문서 및 시트 관리자   |  리소스 라이브러리 (자동 텍스트)   |  날짜 선택기   |  워크 시트 결합   |  셀 암호화/해독    목록으로 이메일 보내기   |  슈퍼 필터   |   특수 필터 (굵게/기울임꼴/취소선 필터링...) ...
상위 15개 도구 세트12 본문 도구 (텍스트 추가, 문자 제거,...)   |   50+ 거래차트 유형 (Gantt 차트,...)   |   40+ 실용 방식 (생일을 기준으로 나이 계산,...)   |   19 삽입 도구 (QR 코드 삽입, 경로에서 그림 삽입,...)   |   12 매출 상승 도구 (숫자를 단어로, 환율,...)   |   7 병합 및 분할 도구 (고급 결합 행, 셀 분할,...)   |   ... 그리고 더

Excel용 Kutools로 Excel 기술을 강화하고 이전과는 전혀 다른 효율성을 경험해 보세요. Excel용 Kutools는 생산성을 높이고 시간을 절약하기 위해 300개 이상의 고급 기능을 제공합니다.  가장 필요한 기능을 얻으려면 여기를 클릭하십시오...

상품 설명


Office Tab은 Office에 탭 인터페이스를 제공하여 작업을 훨씬 쉽게 만듭니다.

  • Word, Excel, PowerPoint에서 탭 편집 및 읽기 사용, Publisher, Access, Visio 및 Project.
  • 새 창이 아닌 동일한 창의 새 탭에서 여러 문서를 열고 만듭니다.
  • 생산성을 50% 높이고 매일 수백 번의 마우스 클릭을 줄입니다!
Comments (31)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
Thank you for this solution, however what if the columns are in separate excel sheet? or is in separate columns instead of a table?
This comment was minimized by the moderator on the site
Hello, Jon,
The methods in this article ar only works well for a range of data, if your data in separate columns, you should copy and paste them into one range first, and then apply the formula or VBA code.
Thank you!
This comment was minimized by the moderator on the site
Thank you for this great article.

For people who are using the array formular in non-English Excel there must be taken special care of the text format string: in your example: "R0C00".
For German this would translate to "Z0S00". However, "S" is a special character refering to seconds for time formating. This character needs to be escaped and therefore the correct format string for German Excel is "Z0\S00".

I hope this helps someone in the future :-)
This comment was minimized by the moderator on the site
Hello, Michael H.
Thanks for your kindly explanation.
Hope this can help others in the future.😄
This comment was minimized by the moderator on the site
Thank you for this great article.

For people who are using the array formular in non-English Excel there must be taken special care of the text format string: in your example: "R0C00".
For German this would translate to "Z0S00". However, "S" is a special character refering to seconds for time formating. This character needs to be escaped and therefore the correct format string for German Excel is "Z0\S00".

I hope this helps someone in the future :-)
This comment was minimized by the moderator on the site
Hello Sir! The VBA worked wonders, thank you very much for that! I was wondering, If I change the original data, is it possible to refresh the column with the unique values automatically?
Rated 5 out of 5
This comment was minimized by the moderator on the site
Hello Ioannis,

Glad to help. After you change the original data, the VBA can not refresh the result automatically. And the easiest way I can think of is to press Ctrl + Alt + F9 to refresh all results in worksheets in all open workbooks. Have a nice day.

Sincerely,
Mandy
This comment was minimized by the moderator on the site
The array formula at the top is working great when used with data in the same sheet, however when I try to use it to reference the same exact data from another sheet the formula returns nothing. I'm unable to figure out why. Is there a limitation with array functions that prevents you from referencing ranges in a different sheet?

Thanks for any insight you can provide.
This comment was minimized by the moderator on the site
Hello Erin,

Glad to help. The INDIRECT function in this formula is more complicated to use when referencing data in other worksheets. It is not recommended to use this feature when referencing ranges in different worksheets.

For example: Now the data is in Sheet1, I want to reference the content of cell C2 of Sheet1 in Sheet2. First, in any two cells in Sheet2, such as D1 and D2, enter Sheet1 and C2, respectively. At this point, enter the formula in the empty cell of Sheet2:
=INDIRECT("'"&D1&"'!"&D2), then the content of cell C2 in Sheet1 can be returned.

As you can see, it make things way more complex. Hope my explanation can help. Have a nice day.

Sincerely,
Mandy
This comment was minimized by the moderator on the site
Czy to żart?
This comment was minimized by the moderator on the site
can we create uniqdata function instead of macro?
This comment was minimized by the moderator on the site
Hi, İlhan,If you like a User Defined Function to create a formula for solving this problem, the below code may help you:After inserting the code, select a list of cells where you want to put the results. Then type this formula:=Uniques(A1:C4)  in the formula bar.Press Ctrl+Shift+Enter keys together. 


Function Uniques(ByVal inputRange As Range)
Dim inputArray As Variant
Dim myColl As New Collection
Dim xVal As Variant
Dim outArray() As Variant
On Error Resume Next
With inputRange
inputArray = Application.Intersect(.Cells, .Parent.UsedRange).Value
End With
On Error GoTo 0
On Error Resume Next
For Each xVal In inputArray
myColl.*** Item:=xVal, Key:=(CStr(xVal) & TypeName(xVal))
Next xVal
myColl.Remove "String"
On Error GoTo 0
ReDim outArray(1 To Application.Max(myColl.Count, Application.Caller.Cells.Count))
For xVal = 1 To UBound(outArray)
outArray(xVal) = vbNullString
Next xVal
For xVal = 1 To Application.Min(myColl.Count, Application.Caller.Cells.Count)
outArray(xVal) = myColl(xVal)
Next xVal
If Application.Caller.Columns.Count = 1 Then
Uniques = Application.Transpose(outArray)
Else
Uniques = outArray
End If
End Function
This comment was minimized by the moderator on the site
Thanks for the code. I'm using the VBA code of this page. Is there a way to add a sorting code after the unique values are extracted so it sorts it automatically?
This comment was minimized by the moderator on the site
Regarding the formula version, could you explain in more detail what this portion is doing? *100+COLUMN($A:$C),7^8)),"R0C00") Specifically, what are the *100, 7^8, and "R0C000" doing? I'm understanding everything else, but I can't figure out what these are for.
This comment was minimized by the moderator on the site
Little late for my response here but...
ROW($2:$9)*100 - this is multiplying the row number *100, so if it's in row 5, now the number is 500
COLUMN($A:$C) - this gets added to the row*100 number, so if it's row 5 col 2, then the number is 502.
7^8)), - this (I think) is to have a max value for the min statement from earlier.
"R0C00") - this formats the text based on the number. In the example, we had 502 so this gives R5C02 (row 5, col 02).

If you have a lot of columns but not many rows, then you could change it to ROW($2:$9)*1000+COLUMN($A:$C),7^8)),"R0C000")
This comment was minimized by the moderator on the site
i've adjusted to my sheet but am only returning the first value in the defined array... what am i missing?
This comment was minimized by the moderator on the site
Hello, Cody,
The above formula works well in my worksheet, could you give a screenshot of your data problem here?
Thank you!
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations