Skip i'r prif gynnwys

Sut i wylio a chyd-fynd â sawl gwerth cyfatebol yn Excel?

Fel y gwyddom i gyd, mae'r Vlookup gall swyddogaeth yn Excel ein helpu i edrych ar werth a dychwelyd y data cyfatebol mewn colofn arall, ond yn gyffredinol, dim ond os oes data paru lluosog y gall gael y gwerth cymharol cyntaf. Yn yr erthygl hon, byddaf yn siarad am sut i wylio a chyd-fynd â gwerthoedd cyfatebol lluosog mewn un gell yn unig neu restr fertigol.

Vlookup a dychwelyd gwerthoedd paru lluosog yn fertigol gyda'r fformiwla

Vlookup a concatenate gwerthoedd paru lluosog mewn cell gyda Swyddogaeth Diffiniedig Defnyddiwr

Vlookup a concatenate gwerthoedd paru lluosog mewn cell gyda Kutools ar gyfer Excel


Gan dybio, mae gen i'r ystod ganlynol o ddata, i gael yr holl werthoedd cyfatebol yn seiliedig ar werth penodol yn fertigol fel y dangosir y screenshot canlynol, gallwch gymhwyso fformiwla arae.

doc vlookup concatenate 1

1. Rhowch y fformiwla hon: =IF(COUNTIF($A$1:$A$16,$D$2)>=ROWS($1:1),INDEX($B$1:$B$16,SMALL(IF($A$1:$A$16=$D$2,ROW($1:$16)),ROW(1:1))),"") mewn cell wag lle rydych chi am roi'r canlyniad, er enghraifft, E2, ac yna pwyso Ctrl + Shift + Enter allweddi gyda'i gilydd i gael y sylfaen gwerth cymharol ar faen prawf penodol, gweler y screenshot:

doc vlookup concatenate 2

Nodyn: Yn y fformiwla uchod:

A1: A16 yw'r ystod golofn sy'n cynnwys y gwerth penodol rydych chi am edrych amdano;

D2 yn nodi'r gwerth penodol yr ydych am ei wylio;

B1: B16 yw'r ystod golofn rydych chi am ddychwelyd y data cyfatebol ohoni;

$ 1: $ 16 yn nodi cyfeirnod y rhesi o fewn yr ystod.

2. Yna dewiswch gell E2, a llusgwch y handlen llenwi i lawr i'r celloedd nes i chi gael celloedd gwag, a rhestrir yr holl werthoedd paru i'r golofn fel y dangosir ar-lein:

doc vlookup concatenate 3


Yn lle cael y gwerthoedd cymharol yn fertigol, weithiau, rydych chi am gael y gwerthoedd paru i mewn i un cell a'u cyd-daro â gwahanydd penodol. Yn yr achos hwn, gall y Swyddogaeth Diffiniedig Defnyddiwr ganlynol wneud ffafr i chi.

1. Dal 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 Modiwlau Ffenestr.

Cod VBA: Vlookup a concatenate gwerthoedd paru lluosog mewn cell

Function CusVlookup(lookupval, lookuprange As Range, indexcol As Long)
'updateby Extendoffice
Dim x As Range
Dim result As String
result = ""
For Each x In lookuprange
    If x = lookupval Then
        result = result & " " & x.Offset(0, indexcol - 1)
    End If
Next x
CusVlookup = result
End Function

3. Yna arbedwch a chau'r cod hwn, ewch yn ôl i'r daflen waith, a nodi'r fformiwla hon: = cusvlookup (D2, A1: B16,2) i mewn i gell wag lle rydych chi am roi'r canlyniad, a gwasgwch Rhowch yn allweddol, mae'r holl werthoedd cyfatebol sy'n seiliedig ar ddata penodol wedi'u dychwelyd i un cell gyda gwahanydd gofod, gweler y screenshot:

doc vlookup concatenate 4

Nodyn: Yn y fformiwla uchod: D2 yn nodi'r gwerthoedd celloedd yr ydych am edrych arnynt, A1: B16 yw'r ystod ddata rydych chi am nôl y data, y rhif 2 yw'r rhif colofn y mae'r gwerth paru i'w ddychwelyd ohono, gallwch newid cyfeiriadau traethodau ymchwil at eich angen.


Os oes gennych Kutools ar gyfer Excel, Gyda'i Rhesi Cyfuno Uwch nodwedd, gallwch chi orffen y swydd hon yn gyflym yn rhwydd. Gall y nodwedd hon eich helpu i gyfuno'r holl werthoedd paru â delimiters penodol yn seiliedig ar yr un data mewn colofn arall.

Kutools ar gyfer Excel : gyda mwy na 300 o ychwanegiadau Excel defnyddiol, am ddim i geisio heb unrhyw gyfyngiad mewn 30 diwrnod.

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

1. Dewiswch yr ystod ddata rydych chi am gael y gwerthoedd cyfatebol yn seiliedig ar y data penodol.

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

3. Yn y Rhesi Cyfuno Uwch blwch deialog, cliciwch enw'r golofn rydych chi am ei chyfuno yn seiliedig, yna cliciwch Allwedd Cynradd botwm, gweler y screenshot:

doc vlookup concatenate 6

4. Yna cliciwch enw colofn arall rydych chi am ddychwelyd y gwerthoedd cyfatebol, a chlicio Cyfunwch i ddewis un gwahanydd i wahanu'r gwerthoedd cyfun, gweler y screenshot:

doc vlookup concatenate 7

5. Ac yna cliciwch Ok botwm, mae'r holl werthoedd cyfatebol sy'n seiliedig ar yr un gwerthoedd wedi'u cyfuno ynghyd â gwahanydd penodol, gweler sgrinluniau:

doc vlookup concatenate 8 2 doc vlookup concatenate 9

 Dadlwythwch a threial am ddim Kutools ar gyfer Excel Nawr !


Kutools ar gyfer Excel: gyda mwy na 300 o ychwanegiadau Excel defnyddiol, am ddim i geisio heb unrhyw gyfyngiad mewn 30 diwrnod. Dadlwythwch a threial am ddim Nawr!

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 (16)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Is there any way to get the unique "name" for "class1"
This comment was minimized by the moderator on the site
Hello, sym-john,
Maybe the below article can solve your problem, please view it:
https://www.extendoffice.com/documents/excel/3381-excel-extract-unique-values-with-criteria.html
This comment was minimized by the moderator on the site
This is working great for me - is there anyway to change it that it checks if the cell contains rather than a complete match? Basically I have a list of tasks where:
Column A: Dependencies (eg 10003 10004 10008)
Column B: Task Reference (eg 10001)
Column C: Dependent Tasks (the column for the formula result) - where it would lookup the task reference to see which rows contain it in Column A, and then list the Task Reference of those tasks.

E.g:

Row | Column A | Column B | Column C
1 | | 10001 | 10002 10003
2 | 10001 | 10002 | 10003
3 | 10001 10002 | 10003 |
This comment was minimized by the moderator on the site
you would want to use the Instr() function which will check for something in a string of text in a cell. You can also use Left() and Right() if you are looking for the starting or ending details.
This comment was minimized by the moderator on the site
The cusVlookup worked great for me. Another way to have a different separator is to wrap in two substitute functions. The first (from inside to out) replaces the first space with no space, the second replaces all other spaces with a " / " in mine. Could use "," if you want commas.
=SUBSTITUTE(SUBSTITUTE(cusVlookup(D2,Table1,2)," ","",1)," "," / ")

Also, if your lookup value isn't the first column, you can use 0 or negative numbers to go to column to the left.
=SUBSTITUTE(SUBSTITUTE(cusVlookup(D2,Table1,-1)," ","",1)," "," / ")
This comment was minimized by the moderator on the site
Hi, jeff,
Thanks for your sharing, you must be a warmhearted man.
This comment was minimized by the moderator on the site
I have to say, I have been trying to get a formula for combining multiple values and returning them to a single cell for 2 days now. This "How To" has saved me!! Thank you SO much! I would never have gotten it without your Module!
I do have 2 questions though. I have the deliminator as a comma instead of a space and because of that it starts out with a comma. Is there a way to prevent the start comma but keep the rest?
My second question is; When I use the fill handle it changes the range values as well as the cell value I want to look up. I want it to continue to change the cell number I want to look up but keep the same range values. How can I make this happen?

Thank you so much for your help!!
This comment was minimized by the moderator on the site
Is there a way to delete the duplicate values in the concatenate?
This comment was minimized by the moderator on the site
Hello, Jacob,
May be the following article can help you to solve your problem.
https://www.extendoffice.com/documents/excel/3381-excel-extract-unique-values-with-criteria.html

Please try, hope it can help you!
This comment was minimized by the moderator on the site
Is there a way to list the duplicate values only once, using the vba code and formula above? I am not sure where to put the countif>1 statement in the formula bar, or in the vba itself. Please help
This comment was minimized by the moderator on the site
you can add two extra condition to skip blank cells and to skip duplicates:For i = 1 To CriteriaRange.Count
If CriteriaRange.Cells(i).Value = Condition Then
If ConcatenateRange.Cells(i).Value <> "" Then 'SKIP BANKS
If InStr(xResult, ConcatenateRange.Cells(i).Value) = 0 Then 'SKIP IF FOUND DUPLICATE
xResult = xResult & Separator & ConcatenateRange.Cells(i).Value
End If
End If
End If
Next i
This comment was minimized by the moderator on the site
This is amazing but i am looking for something else, i have a table with RollNo StudentName sub1, sub2, sub3 ... Total Result, When I enter Rollnumber it should give a result like "SName Sub1 64, sub2 78,... Total 389, Result pass", is it possible
This comment was minimized by the moderator on the site
Loved the function for Excel 2013 but amended it slightly to change the separating character to ";" instead of " " and then remove the prefixed ";" from the concantenated values Results matching values in my example would have ;result01 or ;result01;result02 . Added the extra If Left(xResult, 1) = ";" to remove any extra ";" at the beginning of the string if it is the 1st character. I'm sure there is a neater way of doing it but it worked for me. :) Function CusVlookup(pValue As String, pWorkRng As Range, pIndex As Long) Dim rng As Range Dim xResult As String xResult = "" For Each rng In pWorkRng If rng = pValue Then xResult = xResult & ";" & rng.Offset(0, pIndex - 1) If Left(xResult, 1) = ";" Then xResult = MID(xResult,2,255) End If End If Next CusVlookup = xResult End Function
This comment was minimized by the moderator on the site
Make if condition for result if empty.

Function CusVlookup(lookupval, lookuprange As Range, indexcol As Long)
'updateby Extendoffice 20151118
Dim x As Range
Dim result As String
result = ""
For Each x In lookuprange
If x = lookupval Then
If Not result = "" Then
result = result & " " & x.Offset(0, indexcol - 1)
Else
result = x.Offset(0, indexcol - 1)
End If
Next x
CusVlookup = result
End Function
This comment was minimized by the moderator on the site
When using the cusvlookup is there a way to add the last name as well with a comma in between that might appear in Column C
This comment was minimized by the moderator on the site
How to get the result. Please help. data data1 result a 1 a1 b 2 a2 c b1 b2 c1 c2
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations