Skip i'r prif gynnwys

Sut i wylio i ddychwelyd gwerthoedd lluosog mewn un cell yn Excel?

Fel rheol, yn Excel, pan fyddwch chi'n defnyddio'r swyddogaeth VLOOKUP, os oes sawl gwerth i gyd-fynd â'r meini prawf, gallwch chi gael yr un cyntaf. Ond, weithiau, rydych chi am ddychwelyd yr holl werthoedd cyfatebol sy'n cwrdd â'r meini prawf i mewn i un gell fel y dangosir y screenshot canlynol, sut allech chi ei ddatrys?

Vlookup i ddychwelyd gwerthoedd lluosog i mewn i un gell â swyddogaeth TEXTJOIN (Excel 2019 ac Office 365)

Vlookup i ddychwelyd gwerthoedd lluosog i mewn i un gell gyda Swyddogaeth Diffiniedig Defnyddiwr

Vlookup i ddychwelyd gwerthoedd lluosog i mewn i un gell gyda nodwedd ddefnyddiol


Vlookup i ddychwelyd gwerthoedd lluosog i mewn i un gell â swyddogaeth TEXTJOIN (Excel 2019 ac Office 365)

Os oes gennych y fersiwn uwch o'r Excel fel Excel 2019 ac Office 365, mae swyddogaeth newydd - TEXTJOIN, gyda'r swyddogaeth bwerus hon, gallwch chi edrych yn gyflym a dychwelyd yr holl werthoedd paru i mewn i un cell.

Vlookup i ddychwelyd yr holl werthoedd paru yn un gell

Defnyddiwch y fformiwla isod mewn cell wag lle rydych chi am roi'r canlyniad, yna pwyswch Ctrl + Shift + Enter allweddi gyda'i gilydd i gael y canlyniad cyntaf, ac yna llusgwch y ddolen llenwi i lawr i'r gell rydych chi am ddefnyddio'r fformiwla hon, a byddwch chi'n cael yr holl werthoedd cyfatebol fel y dangosir isod y screenshot:

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

Nodyn: Yn y fformiwla uchod, A2: A11 yw'r ystod edrych yn cynnwys y data edrych, E2 yw'r gwerth edrych, C2: C11 yw'r ystod ddata rydych chi am ddychwelyd y gwerthoedd paru ohoni, ","yw'r gwahanydd i wahanu'r cofnodion lluosog.

Vlookup i ddychwelyd yr holl werthoedd paru heb ddyblygu i mewn i un gell

Os ydych chi am ddychwelyd yr holl werthoedd paru yn seiliedig ar y data edrych heb ddyblygu, gall y fformiwla isod eich helpu chi.

Copïwch a gludwch y fformiwla ganlynol i mewn i gell wag, yna pwyswch Ctrl + Shift + Enter allweddi gyda'i gilydd i gael y canlyniad cyntaf, ac yna copïwch y fformiwla hon i lenwi celloedd eraill, a byddwch yn cael yr holl werthoedd cyfatebol heb y rhai dulpicate fel y dangosir isod y screenshot:

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

Nodyn: Yn y fformiwla uchod, A2: A11 yw'r ystod edrych yn cynnwys y data edrych, E2 yw'r gwerth edrych, C2: C11 yw'r ystod ddata rydych chi am ddychwelyd y gwerthoedd paru ohoni, ","yw'r gwahanydd i wahanu'r cofnodion lluosog.

Vlookup i ddychwelyd gwerthoedd lluosog i mewn i un gell gyda Swyddogaeth Diffiniedig Defnyddiwr

Dim ond ar gyfer Excel 2019 ac Office 365 y mae'r swyddogaeth TEXTJOIN uchod ar gael, os oes gennych fersiynau Excel is eraill, dylech ddefnyddio rhai codau ar gyfer gorffen y dasg hon.

Vlookup i ddychwelyd yr holl werthoedd paru yn un gell

1. Daliwch i lawr y ALT + F11 allweddi, ac mae'n agor y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr.

2. Cliciwch Mewnosod > Modiwlau, a gludwch y cod canlynol yn y Ffenestr Modiwl.

Cod VBA: Vlookup i ddychwelyd gwerthoedd lluosog i mewn i un gell

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. Yna arbedwch a chau'r cod hwn, ewch yn ôl i'r daflen waith, a nodi'r fformiwla hon: =CONCATENATEIF($A$2:$A$11, E2, $C$2:$C$11, ", ") i mewn i gell wag benodol lle rydych chi am osod y canlyniad, yna llusgwch y ddolen llenwi i lawr i gael yr holl werthoedd cyfatebol mewn un cell rydych chi ei eisiau, gweler y screenshot:

Nodyn: Yn y fformiwla uchod, A2: A11 yw'r ystod edrych yn cynnwys y data edrych, E2 yw'r gwerth edrych, C2: C11 yw'r ystod ddata rydych chi am ddychwelyd y gwerthoedd paru ohoni, ","yw'r gwahanydd i wahanu'r cofnodion lluosog.

Vlookup i ddychwelyd yr holl werthoedd paru heb ddyblygu i mewn i un gell

Er mwyn anwybyddu'r dyblygu yn y gwerthoedd paru a ddychwelwyd, gwnewch y cod isod.

1. Daliwch i lawr y Alt + F11 allweddi i agor y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr.

2. Cliciwch Mewnosod > Modiwlau, a gludwch y cod canlynol yn y Ffenestr Modiwl.

Cod VBA: Vlookup a dychwelyd nifer o werthoedd cyfatebol unigryw i mewn i un gell

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. Ar ôl mewnosod y cod, yna cliciwch offer > Cyfeiriadau yn yr agored Microsoft Visual Basic ar gyfer Ceisiadau ffenestr, ac yna, yn y popped allan Cyfeiriadau - VBAProject blwch deialog, gwirio Amser Rhedeg Sgriptio Microsoft opsiwn yn y Cyfeiriadau sydd ar Gael blwch rhestr, gweler sgrinluniau:

4. Yna cliciwch OK i gau'r blwch deialog, cadw a chau'r ffenestr god, dychwelyd i'r daflen waith, a nodi'r fformiwla hon: =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:

Nodyn: Yn y fformiwla uchod, A2: C11 yw'r ystod ddata rydych chi am ei defnyddio, E2 yw'r gwerth edrych, y rhif 3 yw rhif y golofn sy'n cynnwys y gwerthoedd a ddychwelwyd.

Vlookup i ddychwelyd gwerthoedd lluosog i mewn i un gell gyda nodwedd ddefnyddiol

 Os oes gennych ein Kutools ar gyfer Excel, Gyda'i Rhesi Cyfuno Uwch nodwedd, gallwch chi uno neu gyfuno'r rhesi yn gyflym yn seiliedig ar yr un gwerth a gwneud rhai cyfrifiadau ag sydd eu hangen arnoch chi.

Nodyn:I gymhwyso hyn Rhesi Cyfuno Uwch, yn gyntaf, dylech lawrlwytho'r Kutools ar gyfer Excel, ac yna cymhwyswch y nodwedd yn gyflym ac yn hawdd.

Ar ôl gosod Kutools ar gyfer Excel, gwnewch fel a ganlyn:

1. Dewiswch yr ystod ddata rydych chi am gyfuno data un golofn yn seiliedig ar golofn arall.

2. Cliciwch Kutools > Uno a Hollti > Rhesi Cyfuno Uwch, gweler y screenshot:

3. Yn y popped allan Rhesi Cyfuno Uwch blwch deialog:

  • Cliciwch enw'r golofn allweddol i'w chyfuno yn seiliedig ar, ac yna cliciwch Allwedd Cynradd
  • Yna cliciwch colofn arall yr ydych am gyfuno ei data yn seiliedig ar y golofn allweddol, a chlicio Cyfunwch i ddewis un gwahanydd ar gyfer gwahanu'r data cyfun.

4. Yna cliciwch OK botwm, a byddwch yn cael y canlyniadau canlynol:

Dadlwythwch a threial am ddim Kutools ar gyfer Excel Nawr !


Erthyglau mwy cymharol:

  • Swyddogaeth VLOOKUP Gyda Rhai Enghreifftiau Sylfaenol ac Uwch
  • Yn Excel, mae swyddogaeth VLOOKUP yn swyddogaeth bwerus i'r rhan fwyaf o ddefnyddwyr Excel, a ddefnyddir i chwilio am werth yn y chwith mwyaf o'r ystod ddata, a dychwelyd gwerth paru yn yr un rhes o golofn a nodwyd gennych. Mae'r tiwtorial hwn yn siarad am sut i ddefnyddio swyddogaeth VLOOKUP gyda rhai enghreifftiau sylfaenol ac uwch yn Excel.
  • Dychwelwch werthoedd paru lluosog yn seiliedig ar un neu fwy o feini prawf
  • Fel rheol, mae'n hawdd i'r mwyafrif ohonom edrych ar werth penodol a dychwelyd yr eitem baru trwy ddefnyddio'r swyddogaeth VLOOKUP. Ond, a ydych erioed wedi ceisio dychwelyd gwerthoedd paru lluosog yn seiliedig ar un neu fwy o feini prawf? Yn yr erthygl hon, byddaf yn cyflwyno rhai fformiwlâu ar gyfer datrys y dasg gymhleth hon yn Excel.
  • Vlookup A Dychwelyd Gwerthoedd Lluosog yn Fertigol
  • Fel rheol, gallwch ddefnyddio'r swyddogaeth Vlookup i gael y gwerth cyfatebol cyntaf, ond, weithiau, rydych chi am ddychwelyd yr holl gofnodion paru yn seiliedig ar faen prawf penodol. Yr erthygl hon, byddaf yn siarad am sut i wylio a dychwelyd yr holl werthoedd paru yn fertigol, yn llorweddol neu i mewn i un gell.
  • Vlookup A Dychwelyd Gwerthoedd Lluosog O'r Rhestr Gostwng
  • Yn Excel, sut allech chi wylio a dychwelyd sawl gwerth cyfatebol o gwymplen, sy'n golygu pan fyddwch chi'n dewis un eitem o'r gwymplen, mae ei holl werthoedd cymharol yn cael eu harddangos ar unwaith. Yr erthygl hon, byddaf yn cyflwyno'r datrysiad gam wrth gam.

Offer Cynhyrchiant Swyddfa Gorau

🤖 Kutools AI Aide: Chwyldro dadansoddi data yn seiliedig ar: Cyflawniad Deallus   |  Cynhyrchu Cod  |  Creu Fformiwlâu Personol  |  Dadansoddi Data a Chynhyrchu Siartiau  |  Invoke Swyddogaethau Kutools...
Nodweddion Poblogaidd: Darganfod, Amlygu neu Adnabod Dyblygiadau   |  Dileu Rhesi Gwag   |  Cyfuno Colofnau neu Gelloedd heb Colli Data   |   Rownd heb Fformiwla ...
Super-edrych: VLookup Meini Prawf Lluosog    VLookup Gwerth Lluosog  |   VLookup Ar Draws Taflenni Lluosog   |   Edrych Niwlog ....
Rhestr gwympo Uwch: Creu Rhestr Gollwng yn Gyflym   |  Rhestr Gollwng Dibynnol   |  Rhestr Gollwng Aml-ddewis ....
Rheolwr Colofn: Ychwanegu Nifer Penodol o Golofnau  |  Symud Colofnau  |  Toglo Statws Gwelededd Colofnau Cudd  |  Cymharwch Ystodau a Cholofnau ...
Nodweddion dan Sylw: Ffocws ar y Grid   |  Golwg Dylunio   |   Bar Fformiwla Mawr    Rheolwr Llyfr Gwaith a Thaflen   |  Llyfrgell Adnoddau (Testun Auto)   |  Dewiswr Dyddiad   |  Cyfuno Taflenni Gwaith   |  Amgryptio/Dadgryptio Celloedd    Anfon E-byst trwy Restr   |  Hidlo Super   |   Hidlo Arbennig (hidlo mewn print trwm/italig/strikethrough...) ...
15 Set Offer Gorau12 Testun offer (Ychwanegu Testun, Dileu Cymeriadau,...)   |   50 + Siart Mathau (Siart Gantt,...)   |   40+ Ymarferol Fformiwlâu (Cyfrifwch oedran yn seiliedig ar ben-blwydd,...)   |   19 mewnosod offer (Mewnosod Cod QR, Mewnosod Llun o'r Llwybr,...)   |   12 Trosi offer (Rhifau i Eiriau, Trosi arian cyfred,...)   |   7 Uno a Hollti offer (Rhesi Cyfuno Uwch, Celloedd Hollt,...)   |   ... a mwy

Supercharge Eich Sgiliau Excel gyda Kutools ar gyfer Excel, a Phrofiad Effeithlonrwydd Fel Erioed Erioed. Kutools ar gyfer Excel Yn Cynnig Dros 300 o Nodweddion Uwch i Hybu Cynhyrchiant ac Arbed Amser.  Cliciwch Yma i Gael Y Nodwedd Sydd Ei Angen Y Mwyaf...

Disgrifiad


Mae Office Tab yn dod â rhyngwyneb Tabbed i Office, ac yn Gwneud Eich Gwaith yn Haws o lawer

  • Galluogi golygu a darllen tabbed yn Word, Excel, PowerPoint, Cyhoeddwr, Mynediad, Visio a Phrosiect.
  • Agor a chreu dogfennau lluosog mewn tabiau newydd o'r un ffenestr, yn hytrach nag mewn ffenestri newydd.
  • Yn cynyddu eich cynhyrchiant 50%, ac yn lleihau cannoedd o gliciau llygoden i chi bob dydd!
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