메인 컨텐츠로 가기

Excel에서 한 셀에 여러 값을 반환하도록 vlookup하는 방법은 무엇입니까?

일반적으로 Excel에서 VLOOKUP 함수를 사용할 때 기준과 일치하는 값이 여러 개 있으면 첫 번째 값만 가져올 수 있습니다. 그러나 때로는 다음 스크린 샷과 같이 기준을 충족하는 모든 해당 값을 하나의 셀에 반환하고 싶을 때 어떻게 해결할 수 있습니까?

TEXTJOIN 함수를 사용하여 여러 값을 하나의 셀로 반환하는 Vlookup (Excel 2019 및 Office 365)

사용자 정의 함수를 사용하여 여러 값을 하나의 셀로 반환하는 Vlookup

유용한 기능을 사용하여 여러 값을 하나의 셀로 반환하는 Vlookup


TEXTJOIN 함수를 사용하여 여러 값을 하나의 셀로 반환하는 Vlookup (Excel 2019 및 Office 365)

Excel 2019 및 Office 365와 같은 더 높은 버전의 Excel이있는 경우 새로운 기능이 있습니다. 텍스트 조인,이 강력한 기능을 사용하면 빠르게 vlookup하고 일치하는 모든 값을 하나의 셀로 반환 할 수 있습니다.

일치하는 모든 값을 하나의 셀로 반환하는 Vlookup

결과를 입력 할 빈 셀에 아래 수식을 적용한 다음 Ctrl + Shift + Enter 키를 함께 사용하여 첫 번째 결과를 얻은 다음 채우기 핸들을이 수식을 사용하려는 셀로 드래그하면 아래 스크린 샷과 같이 해당하는 모든 값이 표시됩니다.

=TEXTJOIN(",",TRUE,IF($A$2:$A$11=E2,$C$2:$C$11,""))

참고 : 위 공식에서 A2 : A11 조회 범위에는 조회 데이터가 포함됩니다. E2 조회 값입니다. C2 : C11 "에서 일치하는 값을 반환 할 데이터 범위입니다.,"는 여러 레코드를 구분하는 구분 기호입니다.

중복되지 않은 모든 일치 값을 하나의 셀로 반환하는 Vlookup

중복없이 조회 데이터를 기반으로 일치하는 모든 값을 반환하려면 아래 수식이 도움이 될 수 있습니다.

다음 수식을 복사하여 빈 셀에 붙여 넣은 다음 Ctrl + Shift + Enter 키를 함께 사용하여 첫 번째 결과를 얻은 다음이 수식을 복사하여 다른 셀을 채우면 아래 스크린 샷과 같이 dulpicate 값없이 해당하는 모든 값을 얻을 수 있습니다.

=TEXTJOIN(",", TRUE, IF(IFERROR(MATCH($C$2:$C$11, IF(E2=$A$2:$A$11, $C$2:$C$11, ""), 0),"")=MATCH(ROW($C$2:$C$11), ROW($C$2:$C$11)), $C$2:$C$11, ""))

참고 : 위 공식에서 A2 : A11 조회 범위에는 조회 데이터가 포함됩니다. E2 조회 값입니다. C2 : C11 "에서 일치하는 값을 반환 할 데이터 범위입니다.,"는 여러 레코드를 구분하는 구분 기호입니다.

사용자 정의 함수를 사용하여 여러 값을 하나의 셀로 반환하는 Vlookup

위의 TEXTJOIN 함수는 Excel 2019 및 Office 365에서만 사용할 수 있으며, 다른 하위 Excel 버전이있는 경우이 작업을 완료하기 위해 일부 코드를 사용해야합니다.

일치하는 모든 값을 하나의 셀로 반환하는 Vlookup

1. 누르고 ALT + F11 키가 열립니다. 응용 프로그램 용 Microsoft Visual Basic 창.

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

VBA 코드 : 여러 값을 하나의 셀로 반환하는 Vlookup

Function ConcatenateIf(CriteriaRange As Range, Condition As Variant, ConcatenateRange As Range, Optional Separator As String = ",") As Variant
'Updateby Extendoffice
Dim xResult As String
On Error Resume Next
If CriteriaRange.Count <> ConcatenateRange.Count Then
    ConcatenateIf = CVErr(xlErrRef)
    Exit Function
End If
For i = 1 To CriteriaRange.Count
    If CriteriaRange.Cells(i).Value = Condition Then
        xResult = xResult & Separator & ConcatenateRange.Cells(i).Value
    End If
Next i
If xResult <> "" Then
    xResult = VBA.Mid(xResult, VBA.Len(Separator) + 1)
End If
ConcatenateIf = xResult
Exit Function
End Function

3. 그런 다음이 코드를 저장하고 닫은 다음 워크 시트로 돌아가 다음 공식을 입력합니다. =CONCATENATEIF($A$2:$A$11, E2, $C$2:$C$11, ", ") 결과를 배치하려는 특정 빈 셀에 넣은 다음 채우기 핸들을 아래로 끌어 원하는 한 셀의 모든 해당 값을 가져옵니다. 스크린 샷을 참조하십시오.

참고 : 위 공식에서 A2 : A11 조회 범위에는 조회 데이터가 포함됩니다. E2 조회 값입니다. C2 : C11 "에서 일치하는 값을 반환 할 데이터 범위입니다.,"는 여러 레코드를 구분하는 구분 기호입니다.

중복되지 않은 모든 일치 값을 하나의 셀로 반환하는 Vlookup

반환 된 일치 값의 중복을 무시하려면 아래 코드를 사용하십시오.

1. 누르고 Alt + F11 키를 눌러 응용 프로그램 용 Microsoft Visual Basic 창.

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

VBA 코드 : Vlookup 및 여러 고유 한 일치 값을 하나의 셀로 반환

Function MultipleLookupNoRept(Lookupvalue As String, LookupRange As Range, ColumnNumber As Integer)
'Updateby Extendoffice
    Dim xDic As New Dictionary
    Dim xRows As Long
    Dim xStr As String
    Dim i As Long
    On Error Resume Next
    xRows = LookupRange.Rows.Count
    For i = 1 To xRows
        If LookupRange.Columns(1).Cells(i).Value = Lookupvalue Then
            xDic.Add LookupRange.Columns(ColumnNumber).Cells(i).Value, ""
        End If
    Next
    xStr = ""
    MultipleLookupNoRept = xStr
    If xDic.Count > 0 Then
        For i = 0 To xDic.Count - 1
            xStr = xStr & xDic.Keys(i) & ","
        Next
        MultipleLookupNoRept = Left(xStr, Len(xStr) - 1)
    End If
End Function

3. 코드를 삽입 한 후 도구 > 참고자료 열린 응용 프로그램 용 Microsoft Visual Basic 창에서 튀어 나온 참조 – VBAProject 대화 상자, 확인 Microsoft 스크립팅 런타임 에서 옵션 사용 가능한 참조 목록 상자, 스크린 샷 참조 :

4. 그런 다음 OK 대화 상자를 닫으려면 코드 창을 저장하고 닫은 다음 워크 시트로 돌아가 다음 수식을 입력합니다. =MultipleLookupNoRept(E2,$A$2:$C$11,3) into a blank cell where you want to output the result, and then drag the fill hanlde down to get all matching values, see screenshot:

참고 : 위 공식에서 A2 : C11 사용할 데이터 범위입니다. E2 조회 값, 숫자 3 반환 된 값을 포함하는 열 번호입니다.

유용한 기능을 사용하여 여러 값을 하나의 셀로 반환하는 Vlookup

 당신은 우리가있는 경우 Excel 용 Kutools그와 고급 결합 행 기능을 사용하면 동일한 값을 기반으로 행을 빠르게 병합하거나 결합하고 필요에 따라 몇 가지 계산을 수행 할 수 있습니다.

참고 :이것을 적용하려면 고급 결합 행, 먼저 Excel 용 Kutools을 클릭 한 다음 기능을 빠르고 쉽게 적용하십시오.

설치 후 Excel 용 Kutools, 다음과 같이하십시오.

1. 다른 열을 기준으로 한 열 데이터를 결합 할 데이터 범위를 선택합니다.

2. 딸깍 하는 소리 쿠툴 > 병합 및 분할 > 고급 결합 행, 스크린 샷 참조 :

3. 튀어 나온 고급 결합 행 대화 상자 :

  • 결합 할 키 열 이름을 클릭 한 다음 기본 키
  • 그런 다음 키 열을 기반으로 데이터를 결합 할 다른 열을 클릭하고 결합 결합 된 데이터를 구분하기 위해 하나의 구분 기호를 선택합니다.

4. 그런 다음 OK 버튼을 누르면 다음과 같은 결과가 나타납니다.

Excel 용 Kutools를 지금 다운로드하고 무료로 평가하십시오!


더 많은 관련 기사 :

  • 일부 기본 및 고급 예제가 포함 된 VLOOKUP 함수
  • Excel에서 VLOOKUP 함수는 대부분의 Excel 사용자에게 강력한 함수로, 데이터 범위의 가장 왼쪽에있는 값을 찾고 지정한 열의 동일한 행에서 일치하는 값을 반환하는 데 사용됩니다. 이 자습서에서는 Excel의 기본 및 고급 예제와 함께 VLOOKUP 함수를 사용하는 방법에 대해 설명합니다.
  • 하나 또는 여러 기준에 따라 여러 일치 값 반환
  • 일반적으로 VLOOKUP 함수를 사용하면 특정 값을 조회하고 일치하는 항목을 반환하는 것이 대부분 쉽습니다. 그러나 하나 이상의 기준에 따라 여러 일치 값을 반환하려고 시도한 적이 있습니까? 이 기사에서는 Excel에서이 복잡한 작업을 해결하기위한 몇 가지 공식을 소개합니다.
  • Vlookup 및 세로로 여러 값 반환
  • 일반적으로 Vlookup 함수를 사용하여 첫 번째 해당 값을 가져올 수 있지만 때로는 특정 기준을 기반으로 일치하는 모든 레코드를 반환하려고합니다. 이 기사에서는 일치하는 모든 값을 수직, 수평 또는 단일 셀로 vlookup하고 반환하는 방법에 대해 설명합니다.
  • 드롭 다운 목록에서 Vlookup 및 여러 값 반환
  • 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 (43)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I have created a problem.
"I" have combined a "Textjoin" end "Vlookup" to return multiple values in to one single cell.
My problem is that the formula have to have an exact value to look for and I want it to lookup an "almost" match or Partial match.

Example: I have made a schedule how we ate going to work and a D1 is working from 07:30-16:00. And to lookup D1 is not the problem, the problem is that my boss sometimes puts other stuff togeather with the D1... Like "D1 +" or "D1 meeting".
Since my formula only lookup "D1" it misses for example the "D1 +".

My formula (that I have gotten from the web) =TEXTJOIN(" och ";SANT;OM($B$3:$B$15=$C$22:$F$22;$A$3:$A$15;""))It´s in swedish so "SANT" is "TRUE" and "OM" is "IF".

How can I make the formula lookup all the cells that have some form of "D1" in it and return all those to the same cell?
No matter if it says "D1 +" or "D1 meeting" or whatever.
The reson I want this, is because the boss always leave "D1" but can add other text behind the "D1"... and just because of that, my boss messes up my formula.
This comment was minimized by the moderator on the site
Hi!
This is a great VBA-Code which could help me a lot.But when I start the Function MultipleLookupNoRept Excel crashs...I´ve got a Dataset with about 6.000 Rows (Excel 2013).... is this too much for the VBA Function?

Thanks!
This comment was minimized by the moderator on the site
Hello Mr.XXL,Sorry to hear that. The row limit for Excel 2013 is 1048576. Therefore, maybe the VBA code is the reason for the crash.
Anyway, I would love to offer you another VBA code for Vlookup To Return All Matching Values Without Duplicates Into One Cell. Please use the VBA code below:
Option Explicit

Function Lookup_concat(Search_string As String, _
Search_in_col As Range, Return_val_col As Range)

Dim i As Long
Dim temp() As Variant
Dim result As String
ReDim temp(0)

For i = 1 To Search_in_col.Count
If Search_in_col.Cells(i, 1) = Search_string Then
temp(UBound(temp)) = Return_val_col.Cells(i, 1).Value
ReDim Preserve temp(UBound(temp) + 1)
End If
Next

If temp(0) <> "" Then
ReDim Preserve temp(UBound(temp) - 1)
Unique temp
For i = LBound(temp) To UBound(temp)
result = result & " " & temp(i)
Next i
Lookup_concat = Trim(result)
Else
Lookup_concat = ""
End If

End Function

Function Unique(tempArray As Variant)

Dim coll As New Collection
Dim Value As Variant

On Error Resume Next
For Each Value In tempArray
If Len(Value) > 0 Then coll.Add Value, CStr(Value)
Next Value
On Error GoTo 0

ReDim tempArray(0)

For Each Value In coll
tempArray(UBound(tempArray)) = Value
ReDim Preserve tempArray(UBound(tempArray) + 1)
Next Value

End Function

After you insert this VBA code in the Module, please type the formula =Lookup_concat(E2,$A$2:$A$14,$C$2:$C$14) into a blank cell where you want to output the result, and then drag the fill hanlde down to get all matching values. Please see the file I uploaded in this comment. Hope it solves your problem. 
Sincerely,Mandy

This comment was minimized by the moderator on the site
Hi, Thanks so much this worked!I used it to pull dates, that populated in the serial number format (<span style="letter-spacing: 0.2px; color: inherit; font-family: inherit; font-style: inherit; font-variant-ligatures: inherit; font-variant-caps: inherit; font-weight: inherit;">Changing the format to short date format using =TEXT(A2,”mm/dd/yy”) OR =DATEVALUE(A2) are not working. Do you have any solutions?</span>
This comment was minimized by the moderator on the site
Thank you for the explanations, however the function 'MultipleLookupNoRept' does not work on my file, could you tell me if an error exists.
This comment was minimized by the moderator on the site
Hi, Hasnae,Please check if you miss the third step -  check Microsoft Scripting Runtime option in the Available References list box.

This comment was minimized by the moderator on the site
Thank you so much for the code. Is there a way I can use the code to look up multiple values from multiple sheets? I tried to combine your function with IFERROR function but it doesn't seem to work.
This comment was minimized by the moderator on the site
Can this be modified to place the sum of those values? Instead of (400 400 400 400 400 400), can it sum them to show (2400)?
This comment was minimized by the moderator on the site
How with HLookUp function?
This comment was minimized by the moderator on the site
thanks for the code. I have modified it to allow you to optionally specify your own separator, Default is " ", if you specify the separator as"#cr" it will insert a CR/LF so the values will be on a separate line in the cell. It only applies the separator if there are multiple values

Function MYVLOOKUP(pValue As String, pWorkRng As Range, pIndex As Long, Optional ByVal pSep As Variant)

' ### Returns multiple values from a table into 1 cell ###

' pValue is the key value to lookup

' WorkRng is the Table you want to look up

' pIndex is the column # for the values to be returned from the pWorkRng

' pSep (optional) is the separator to be used. if omitted then default is a space (it doesn't apply the separator for the 1st entry)

' if the separtor = "#cr" it will separate the values on different line in the cell

Dim rng As Range

Dim sSep As String

Dim xResult As String

Dim Item1 As Boolean

Item1 = True



If IsMissing(pSep) = True Then

sSep = vbCr

Else

If pSep = "#cr" Then

sSep = vbCrLf

Else

sSep = pSep

End If

End If



xResult = ""

For Each rng In pWorkRng

If rng = pValue Then

If Item1 Then

xResult = xResult & rng.Offset(0, pIndex - 1)

Item1 = False

Else

xResult = xResult & sSep & rng.Offset(0, pIndex - 1)

End If

End If

Next

MYVLOOKUP = xResult

End Function
This comment was minimized by the moderator on the site
Thank you for this, the line breaks are what i needed to top this formula off! Question, is there a way to modify the code so that two values are compared? For example, similar to what we see with index and match, can i look for Product and Quantity columns, and based on those parameters it outputs results from the Region Column?
This comment was minimized by the moderator on the site
Thanks a lot for this code, it is very helpful. Does anyone know away to sum the values in the cell to just have at total of them.
Cheers
This comment was minimized by the moderator on the site
Hello, James, to sum values based on the corresponding items, the following article may help you, please chek it:
https://www.extendoffice.com/documents/excel/1268-excel-combine-duplicate-rows-and-sum.html
This comment was minimized by the moderator on the site
I have a server, it has connected with multiple applications. I want to compare compare two column and get the related applications details for that server.

What is the command for that.
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