Ga naar hoofdinhoud

Hoe vlookup om meerdere waarden in één cel in Excel te retourneren?

Normaal gesproken kunt u in Excel, wanneer u de functie VERT.ZOEKEN gebruikt, als er meerdere waarden zijn die aan de criteria voldoen, gewoon de eerste krijgen. Maar soms wilt u alle corresponderende waarden die aan de criteria voldoen, in één cel retourneren zoals in het onderstaande screenshot, hoe zou u dit kunnen oplossen?

Vlookup om meerdere waarden in één cel te retourneren met de TEXTJOIN-functie (Excel 2019 en Office 365)

Vlookup om meerdere waarden in één cel te retourneren met door de gebruiker gedefinieerde functie

Vlookup om meerdere waarden in één cel te retourneren met een handige functie


Vlookup om meerdere waarden in één cel te retourneren met de TEXTJOIN-functie (Excel 2019 en Office 365)

Als je de hogere versie van Excel hebt, zoals Excel 2019 en Office 365, is er een nieuwe functie - TEKSTJOINMet deze krachtige functie kunt u snel alle overeenkomende waarden opvouwen en in één cel retourneren.

Vlookup om alle overeenkomende waarden in één cel te retourneren

Pas de onderstaande formule toe in een lege cel waar u het resultaat wilt plaatsen en druk vervolgens op Ctrl + Shift + Enter toetsen samen om het eerste resultaat te krijgen en sleep vervolgens de vulgreep naar de cel waarin u deze formule wilt gebruiken, en u krijgt alle bijbehorende waarden zoals hieronder afgebeeld:

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

Opmerking: In de bovenstaande formule, A2: A11 is het opzoekbereik de opzoekgegevens bevat, E2 is de opzoekwaarde, C2: C11 is het gegevensbereik waarvan u de overeenkomende waarden wilt retourneren, ","is het scheidingsteken om de meerdere records te scheiden.

Vlookup om alle overeenkomende waarden zonder duplicaten in één cel te retourneren

Als u alle overeenkomende waarden wilt retourneren op basis van de opzoekgegevens zonder duplicaten, kan de onderstaande formule u helpen.

Kopieer en plak de volgende formule in een lege cel en druk op Ctrl + Shift + Enter sleutels samen om het eerste resultaat te krijgen, en kopieer vervolgens deze formule om andere cellen te vullen, en je krijgt alle corresponderende waarden zonder de dulpicatie zoals onderstaand screenshot getoond:

=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, ""))

Opmerking: In de bovenstaande formule, A2: A11 is het opzoekbereik de opzoekgegevens bevat, E2 is de opzoekwaarde, C2: C11 is het gegevensbereik waarvan u de overeenkomende waarden wilt retourneren, ","is het scheidingsteken om de meerdere records te scheiden.

Vlookup om meerdere waarden in één cel te retourneren met door de gebruiker gedefinieerde functie

De bovenstaande TEXTJOIN-functie is alleen beschikbaar voor Excel 2019 en Office 365, als u andere lagere Excel-versies heeft, moet u enkele codes gebruiken om deze taak te voltooien.

Vlookup om alle overeenkomende waarden in één cel te retourneren

1. Houd de ALT + F11 toetsen, en het opent de Microsoft Visual Basic voor toepassingen venster.

2. Klikken Invoegen > Moduleen plak de volgende code in het Module Venster.

VBA-code: Vlookup om meerdere waarden in één cel te retourneren

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. Sla vervolgens deze code op en sluit deze, ga terug naar het werkblad en voer deze formule in: =CONCATENATEIF($A$2:$A$11, E2, $C$2:$C$11, ", ") in een specifieke lege cel waar u het resultaat wilt plaatsen en sleep vervolgens de vulgreep naar beneden om alle overeenkomstige waarden in één cel te krijgen die u wilt, zie screenshot:

Opmerking: In de bovenstaande formule, A2: A11 is het opzoekbereik de opzoekgegevens bevat, E2 is de opzoekwaarde, C2: C11 is het gegevensbereik waarvan u de overeenkomende waarden wilt retourneren, ","is het scheidingsteken om de meerdere records te scheiden.

Vlookup om alle overeenkomende waarden zonder duplicaten in één cel te retourneren

Gebruik de onderstaande code om de duplicaten in de geretourneerde overeenkomende waarden te negeren.

1. Houd de Alt + F11 toetsen om de te openen Microsoft Visual Basic voor toepassingen venster.

2. Klikken Invoegen > Moduleen plak de volgende code in het Module Venster.

VBA-code: Vlookup en retourneer meerdere unieke overeenkomende waarden in één cel

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. Nadat u de code heeft ingevoerd, klikt u op Tools > Referenties in de geopende Microsoft Visual Basic voor toepassingen venster, en dan, in de pop-out Referenties - VBAProject dialoogvenster, vink aan Microsoft Scripting-runtime optie in het Beschikbare referenties keuzelijst, zie screenshots:

4. Dan klikken OK om het dialoogvenster te sluiten, slaat u het codevenster op en sluit u het, keert u terug naar het werkblad en voert u deze formule in: =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:

Opmerking: In de bovenstaande formule, A2: C11 is het gegevensbereik dat u wilt gebruiken, E2 is de opzoekwaarde, het nummer 3 is het kolomnummer dat de geretourneerde waarden bevat.

Vlookup om meerdere waarden in één cel te retourneren met een handige functie

 Als u ons Kutools for Excel, Met Geavanceerd Combineer rijen functie, kunt u snel de rijen samenvoegen of combineren op basis van dezelfde waarde en enkele berekeningen uitvoeren als u nodig hebt.

Opmerking:Om dit toe te passen Geavanceerd Combineer rijen, ten eerste moet u het Kutools for Excelen pas de functie vervolgens snel en gemakkelijk toe.

Na het installeren van Kutools for Excelgaat u als volgt te werk:

1. Selecteer het gegevensbereik waarvoor u de ene kolomgegevens wilt combineren op basis van een andere kolom.

2. Klikken Kutools > Samenvoegen en splitsen > Geavanceerd Combineer rijen, zie screenshot:

3. In de pop-out Geavanceerd Combineer rijen dialoog venster:

  • Klik op de naam van de sleutelkolom die u wilt combineren op basis van, en klik vervolgens op Hoofdsleutel
  • Klik vervolgens op een andere kolom waarvan u de gegevens wilt combineren op basis van de sleutelkolom, en klik op Combineren om een ​​scheidingsteken te kiezen voor het scheiden van de gecombineerde gegevens.

4. Dan klikken OK knop, en je krijgt de volgende resultaten:

Download en gratis proef Kutools voor Excel nu!


Meer relatieve artikelen:

  • VERT.ZOEKEN-functie met enkele eenvoudige en geavanceerde voorbeelden
  • In Excel is de functie VERT.ZOEKEN een krachtige functie voor de meeste Excel-gebruikers, die wordt gebruikt om naar een waarde uiterst links in het gegevensbereik te zoeken en een overeenkomende waarde in dezelfde rij te retourneren vanuit een kolom die u hebt opgegeven. Deze tutorial heeft het over het gebruik van de functie VERT.ZOEKEN met enkele basis- en geavanceerde voorbeelden in Excel.
  • Retourneer meerdere overeenkomende waarden op basis van een of meerdere criteria
  • Normaal gesproken is het opzoeken van een specifieke waarde en het retourneren van het overeenkomende item voor de meesten van ons eenvoudig met de functie VERT.ZOEKEN. Maar heb je ooit geprobeerd om meerdere overeenkomende waarden te retourneren op basis van een of meer criteria? In dit artikel zal ik enkele formules introduceren om deze complexe taak in Excel op te lossen.
  • Bekijk en retourneer meerdere waarden verticaal
  • Normaal gesproken kunt u de functie Vlookup gebruiken om de eerste overeenkomstige waarde te krijgen, maar soms wilt u alle overeenkomende records retourneren op basis van een specifiek criterium. In dit artikel zal ik het hebben over het opvullen en retourneren van alle overeenkomende waarden verticaal, horizontaal of in één enkele cel.
  • Bekijk en retourneer meerdere waarden uit de vervolgkeuzelijst
  • Hoe kunt u in Excel meerdere overeenkomstige waarden opvragen en retourneren uit een vervolgkeuzelijst, wat betekent dat wanneer u één item uit de vervolgkeuzelijst kiest, alle relatieve waarden tegelijk worden weergegeven. In dit artikel zal ik de oplossing stap voor stap introduceren.

Beste Office-productiviteitstools

🤖 Kutools AI-assistent: Een revolutie teweegbrengen in de data-analyse op basis van: Intelligente uitvoering   |  Genereer code  |  Aangepaste formules maken  |  Analyseer gegevens en genereer grafieken  |  Roep Kutools-functies aan...
Populaire functies: Zoek, markeer of identificeer duplicaten   |  Verwijder lege rijen   |  Combineer kolommen of cellen zonder gegevens te verliezen   |   Ronde zonder formule ...
Super opzoeken: Meerdere criteria VLookup    VLookup met meerdere waarden  |   VOpzoeken over meerdere bladen   |   Fuzzy opzoeken ....
Geavanceerde vervolgkeuzelijst: Maak snel een vervolgkeuzelijst   |  Afhankelijke vervolgkeuzelijst   |  Multi-select vervolgkeuzelijst ....
Kolom Beheerder: Voeg een specifiek aantal kolommen toe  |  Kolommen verplaatsen  |  Schakel de zichtbaarheidsstatus van verborgen kolommen in  |  Vergelijk bereiken en kolommen ...
Uitgelichte functies: Raster focus   |  Ontwerpweergave   |   Grote formulebalk    Werkmap- en bladbeheer   |  resource Library (Auto-tekst)   |  Datumkiezer   |  Combineer werkbladen   |  Cellen coderen/decoderen    Stuur e-mails per lijst   |  Super filter   |   Speciaal filter (filter vet/cursief/doorhalen...) ...
Top 15 gereedschapsets12 Tekst Tools (toe te voegen tekst, Tekens verwijderen, ...)   |   50+ tabel Types (Gantt Chart, ...)   |   40+ Praktisch Formules (Bereken leeftijd op basis van verjaardag, ...)   |   19 Invoeging Tools (QR-code invoegen, Afbeelding invoegen vanaf pad, ...)   |   12 Camper ombouw Tools (Getallen naar woorden, Currency Conversion, ...)   |   7 Samenvoegen en splitsen Tools (Geavanceerd Combineer rijen, Gespleten cellen, ...)   |   ... en meer

Geef uw Excel-vaardigheden een boost met Kutools voor Excel en ervaar efficiëntie als nooit tevoren. Kutools voor Excel biedt meer dan 300 geavanceerde functies om de productiviteit te verhogen en tijd te besparen.  Klik hier om de functie te krijgen die u het meest nodig heeft...

Omschrijving


Office-tabblad Brengt een interface met tabbladen naar Office en maakt uw werk veel gemakkelijker

  • Schakel bewerken en lezen met tabbladen in Word, Excel, PowerPoint in, Publisher, Access, Visio en Project.
  • Open en maak meerdere documenten in nieuwe tabbladen van hetzelfde venster in plaats van in nieuwe vensters.
  • Verhoogt uw productiviteit met 50% en vermindert honderden muisklikken voor u elke dag!
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