메인 컨텐츠로 가기

Excel의 열 범위에서 고유 값 목록을 동적으로 추출하는 방법은 무엇입니까?

값이 정기적으로 변경되는 열 범위의 경우 변경 방법에 관계없이 항상 범위에서 모든 고유 값을 가져와야합니다. 고유 값의 동적 목록을 만드는 방법은 무엇입니까? 이 기사는 그것을 다루는 방법을 보여줄 것입니다.

수식을 사용하여 열 범위에서 고유 값 목록을 동적으로 추출
VBA 코드를 사용하여 열 범위에서 고유 값 목록을 동적으로 추출


수식을 사용하여 열 범위에서 고유 값 목록을 동적으로 추출

아래 스크린 샷과 같이 B2 : B9 범위에서 고유 한 값 목록을 동적으로 추출해야합니다. 다음 배열 수식을 시도하십시오.

1. D2와 같은 빈 셀을 선택하고 아래 수식을 입력하고 Ctrl 키 + 변화 + 엔터 버튼 동시에 키. (B2 : B9는 고유 값을 추출하려는 열 데이터이고 D1은 수식이있는 위 셀입니다.)

=IFERROR(INDEX($B$2:$B$9, MATCH(0,COUNTIF($D$1:D1, $B$2:$B$9), 0)),"")

2. D2 셀을 계속 선택한 다음 채우기 핸들을 아래로 끌어 지정된 범위에서 모든 고유 값을 가져옵니다.

이제 열 범위 B2 : B9의 모든 고유 값이 추출됩니다. 이 범위의 값이 변경되면 고유 값 목록이 즉시 동적으로 변경됩니다.

Excel에서 범위의 모든 고유 값을 쉽게 선택하고 강조 표시합니다.

  중복 및 고유 셀 선택 ~의 유용성 Excel 용 Kutools 모든 고유 값 (첫 번째 중복 포함) 또는 한 번만 표시되는 고유 값을 쉽게 선택하고 강조 표시 할 수 있으며 아래 스크린 샷과 같이 필요한 중복 값도 선택할 수 있습니다.
지금 Excel용 Kutools를 다운로드하세요! (30일 무료 트레일)


VBA 코드를 사용하여 열 범위에서 고유 값 목록을 동적으로 추출

다음 VBA 코드를 사용하여 열 범위에서 동적으로 고유 값 목록을 추출 할 수도 있습니다.

1. 프레스 다른 + F11 동시에 열려면 키 응용 프로그램 용 Microsoft Visual Basic 창.

2. 에서 응용 프로그램 용 Microsoft Visual Basic 창을 클릭합니다 끼워 넣다 > 모듈. 그런 다음 아래 VBA 코드를 복사하여 모듈 창.

VBA 코드 : 범위에서 고유 값 목록 추출

Sub CreateUniqueList()
Dim xRng As Range
Dim xLastRow As Long
Dim xLastRow2 As Long
Dim I As Integer
On Error Resume Next
Set xRng = Application.InputBox("Please select range:", "Kutools for Excel", Selection.Address, , , , , 8)
If xRng Is Nothing Then Exit Sub
On Error Resume Next
xRng.Copy Range("D2")
xLastRow = xRng.Rows.Count + 1
ActiveSheet.Range("D2:D" & xLastRow).RemoveDuplicates Columns:=1, Header:=xlNo
xLastRow2 = Cells(Rows.Count, "B").End(xlUp).Row
For I = 1 To xLastRow2
  If ActiveSheet.Range("D2:D" & xLastRow2).Cells(I).Value = "" Then
     ActiveSheet.Range("D2:D" & xLastRow2).Cells(I).Delete
  End If
Next
End Sub

주의 사항: 코드에서 D2는 고유 값 목록을 찾을 셀입니다. 필요에 따라 변경할 수 있습니다.

3. 워크 시트로 돌아가서 끼워 넣다 > 모양 > 구형. 스크린 샷보기 :

4. 워크 시트에 직사각형을 그린 다음 표시 할 단어를 입력합니다. 그런 다음 마우스 오른쪽 버튼으로 클릭하고 매크로 지정 오른쪽 클릭 메뉴에서. 에서 매크로 지정 대화 상자에서 고유 목록 만들기 FBI 증오 범죄 보고서 매크로 이름 상자를 클릭 한 다음 OK 단추. 스크린 샷보기 :

5. 이제 사각형 버튼을 클릭합니다. Excel 용 Kutools 대화 상자가 나타나면 추출해야하는 고유 값이 포함 된 범위를 선택한 다음 OK 버튼을 클릭합니다.

이제부터는 위의 5 단계를 반복하여 고유 값 목록을 자동으로 업데이트 할 수 있습니다.


관련 기사:

최고의 사무 생산성 도구

🤖 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 (35)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
con este procedimiento de filtro se hace de forma muy rapida

1.EN ESTE EJEMPLO los datos a remover los duplicados estan en la col A de la fila 59 a la 239
2. se define un criterio de filtrado en este caso en la fila d56 el mismo titulo de la lista a remover duplicados y la d57 la dejo en blanco
3. una vez ejecutado se muestran los datos en la fila destino, que en mi caso fue la d59

Range("A59:A239").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range _
("D56:D57"), CopyToRange:=Range("D59"), Unique:=True
This comment was minimized by the moderator on the site
I would like to be able to do this exact same thing, except using two separate column ranges (B2:B9) as well as (D2:D9) is this possible?
This comment was minimized by the moderator on the site
Hi Anthony,
You can place the results in the same column as the original data. Such as column B in this case.
But you need to reference the top cell of the result cell in the formula as follows.
=IFERROR(INDEX($B$2:$B$9, MATCH(0,COUNTIF($B$11:B11, $B$2:$B$9), 0)),"") + Ctrl + Shift + Enter
This comment was minimized by the moderator on the site
Ik heb gemerkt dat de 'formule'-methode erg traag werkt bij grote datasets. Een goed alternatief is het gebruik van een draaitabel. Kies dan alleen de rijlabels, je krijgt dan een lijstje met unieke waarden. Het kan zijn dat je wat extra's krijgt "(leeg)" bijvoorbeeld. Je kunt deze er vervolgens uitfilteren. Helaas kun je maar op 1 criterium filteren. Ook daar zijn wel weer oplossingen voor, maar dat is wat complexer.
This comment was minimized by the moderator on the site
how to make the vba code work for a range where another formula was used?on column B I have a formula, referring to columns D and E.
If I use apply the code to column L (let's say), (obviously, properly modifying the cells in the code) the macro returns the formula applied to columns M and N... It works, then, but not as I want!How to keep the values in column B?thanks
This comment was minimized by the moderator on the site
thank you very much
This comment was minimized by the moderator on the site
I try the VBA Code and the formula. The code VBA is working very well but I can't keep a file with macro. But th problem is that I can't make the formula working. Did anybody have an idea ? Thank you
This comment was minimized by the moderator on the site
Hi Charlotte,
Thank you for your comment. You can keep the file with macro for future use by saving the workbook as an Excel Macro-Enabled Workbook.
For the formula problem, would you please provide a screenshot of your data? Thank you for your comment.
This comment was minimized by the moderator on the site
I'm using that =IFERROR(INDEX($B$2:$B$9, MATCH(0,COUNTIF($D$1:D1, $B$2:$B$9), 0)),"") formula which is great for one column but my data is spread across a range of columns and rows. Can I edit the formula to include the whole area? My data lives from AC4 to AR60...
This comment was minimized by the moderator on the site
Hi, thank you for your help.
Now, how can I have my values also sorted alphabetically? (I do not want to use the filter on my master table)
Should I use a COUNTIFS instead of COUNTIF?
Please HELP
This comment was minimized by the moderator on the site
Hi Alexis,
Sorry can't hep to sort the extracted value alphabetically at the same time with formula. Thank you for your comment.
This comment was minimized by the moderator on the site
I am trying to drag the formula down past my actual data so that I can input different sized data sets and not have to adjust anything. However, the last row after my actual data ends always returns a "0". I am using the unique values for something else in an adjacent column, and the 0 causes the last value to repeated (When I delete the 0 the value is no longer repeated). Any idea how to fix this? Also I am using Office 365 Business
This comment was minimized by the moderator on the site
If I do this for a thousand row excel sheet on the latest version of Excel on a Mac, it never returns. The first row works, but when I duplicate down, excel goes into a compute mode that has not returned values for over two hours now.

Any thoughts on how to do this for large lists (up to 2k rows) that will return 50 or 60 unique values?

I mocked this up in the "Numbers" app, and it's working perfectly there, taking only a couple minutes to calculate. It's just taking so long in Excel that I wonder if it will ever complete. I plan on letting it "run" overnight to see what will happen.
This comment was minimized by the moderator on the site
Check your Calculating options. It needs to be set to automatic. File > Options > Formulas > Calculating options > Workbook Calculation (Automatic selection)
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