Բաց թողնել հիմնական բովանդակությունը

Ինչպե՞ս վերադարձնել որոնման բազմաթիվ արժեքներ մեկ ստորակետով առանձնացված բջիջում:

Excel- ում մենք կարող ենք կիրառել VLOOKUP գործառույթը `աղյուսակի բջիջներից առաջին համապատասխանեցված արժեքը վերադարձնելու համար, բայց, երբեմն, մենք պետք է հանենք բոլոր համապատասխանող արժեքները և այնուհետև առանձնացնենք որոշակի սահմանազատիչով, ինչպիսիք են ստորակետը, գծանշումը և այլն: բջիջը, ինչպես ցույց է տրված հետևյալ նկարը Ինչպե՞ս կարող ենք գտնել և վերադարձնել որոնման բազմաթիվ արժեքներ Excel- ում մեկ ստորակետով առանձնացված բջիջում:

doc վերադարձնել բազմաթիվ արժեքներ ստորակետով առանձնացված 1

Վերադարձեք որոնման մի քանի արժեքներ մեկ ստորակետով բաժանված բջիջում `օգտագործողի կողմից սահմանված գործառույթով

Վերադարձեք որոնման բազմաթիվ արժեքներ մեկ ստորակետով առանձնացված բջիջում Kutools- ի համար Excel- ի համար


Վերադարձեք որոնման մի քանի արժեքներ մեկ ստորակետով բաժանված բջիջում `օգտագործողի կողմից սահմանված գործառույթով

Սովորաբար, մեզ համար ուղիղ եղանակ չկա արդյունահանման և վերադարձման բազմաթիվ համընկնող արժեքները, որոնք ստորակետով բաժանվել են մեկ բջիջի, այս գործը լուծելու համար այստեղ կարող եք ստեղծել օգտագործողի կողմից սահմանված գործառույթ, կատարեք հետևյալը.

1, Պահեք պահեք ALT + F11 բացել ստեղները Microsoft Visual Basic հավելվածների համար պատուհան.

2: Սեղմեք Տեղադրել > Մոդուլներ, և տեղադրեք հետևյալ կոդը Մոդուլներ Պատուհանը:

VBA կոդ. Փնտրման բազմաթիվ արժեքներ վերադարձնել մեկ ստորակետով առանձնացված բջիջ

Function SingleCellExtract(LookupValue As String, LookupRange As Range, ColumnNumber As Integer, Char As String)
'Updateby Extendoffice
    Dim I As Long
    Dim xRet As String
    For I = 1 To LookupRange.Columns(1).Cells.Count
        If LookupRange.Cells(I, 1) = LookupValue Then
            If xRet = "" Then
                xRet = LookupRange.Cells(I, ColumnNumber) & Char
            Else
                xRet = xRet & "" & LookupRange.Cells(I, ColumnNumber) & Char
            End If
        End If
    Next
    SingleCellExtract = Left(xRet, Len(xRet) - 1)
End Function

3, Ապա պահեք այս կոդը և փակեք Մոդուլի պատուհանը, վերադարձեք ձեր աշխատաթերթը և մուտքագրեք այս բանաձևը. = SingleCellExtract (D2, A2: B15,2, ",") դատարկ բջիջի մեջ, որը ցանկանում եք վերադարձնել արդյունքը: Եվ հետո սեղմեք Մտնել արդյունք ստանալու համար ստեղնը, տես նկարի նկարը.

doc վերադարձնել բազմաթիվ արժեքներ ստորակետով առանձնացված 2

ՆշումՎերոհիշյալ բանաձևում.

D2: ցույց է տալիս այն բջիջների արժեքները, որոնք ցանկանում եք փնտրել;

A2: B15: տվյալների տիրույթն է, որը ցանկանում եք վերցնել տվյալները.

2.2 թիվը սյունակի համարն է, որը պետք է վերադարձվի համապատասխան արժեքը.

,: ստորակետն այն բաժանարարն է, որը ցանկանում եք տարանջատել բազմակի արժեքները:

Կարող եք դրանք փոխել ըստ ձեր կարիքի:


Վերադարձեք որոնման բազմաթիվ արժեքներ մեկ ստորակետով առանձնացված բջիջում Kutools- ի համար Excel- ի համար

Եթե ​​դուք ունեք Excel- ի համար նախատեսված գործիքներ, այս խնդիրն այլևս խնդիր չի լինի: Ի Ընդլայնված կոմբինատ տողեր օգտակարությունը կարող է օգնել սյունակի հիման վրա միավորել բոլոր հարաբերական արժեքները:

Excel- ի համար նախատեսված գործիքներ : ավելի քան 300 հարմար Excel հավելվածներով, 30 օրվա ընթացքում առանց սահմանափակումների փորձեք անվճար

Տեղադրելուց հետո Excel- ի համար նախատեսված գործիքներխնդրում եմ արեք հետևյալը.

1, Ընտրեք տվյալների տիրույթը, որը ցանկանում եք համատեղել սյունակի վրա հիմնված բոլոր համապատասխան արժեքները:

2: Սեղմեք Կուտոլս > Միաձուլում և պառակտում > Ընդլայնված կոմբինատ տողեր, տես նկարի նկարը.

3, Մեջ Միավորել շարքերը ՝ հիմնվելով սյունակի վրա երկխոսության տուփ, կտտացրեք սյունակի անունը, որի վրա ցանկանում եք միավորել, և այնուհետև կտտացրեք Առաջնային բանալին կոճակը, տես նկարի նկարը.

doc վերադարձնել բազմաթիվ արժեքներ ստորակետով առանձնացված 4

4, Դրանից հետո կտտացրեք սյունակի այլ անունին, որը ցանկանում եք համատեղել դրանց համապատասխան արժեքները և կտտացրեք Միավորել ընտրել մեկ տարանջատիչ `համակցված արժեքներն առանձնացնելու համար, տես նկարի նկարը.

doc վերադարձնել բազմաթիվ արժեքներ ստորակետով առանձնացված 5

5. Այնուհետեւ կտտացրեք OK կոճակը, նույն արժեք ունեցող բոլոր համապատասխան բջիջները միավորվել են մեկ բջիջի մեջ, որոնք բաժանված են ստորակետով, տեսեք սքրինշոթերը.

doc վերադարձնել բազմաթիվ արժեքներ ստորակետով առանձնացված 6 2 doc վերադարձնել բազմաթիվ արժեքներ ստորակետով առանձնացված 7

Սեղմեք ՝ այս Advanced Combine Rows օգտակար ծառայության մասին ավելի մանրամասն տեղեկություններ ստանալու համար

Ներբեռնեք և անվճար փորձեք Kutools- ը Excel- ի համար:


Դեմո. Վերադարձեք որոնման մի քանի արժեքներ մեկ ստորակետով առանձնացված բջիջում Kutools- ի համար Excel- ի համար

Excel- ի համար նախատեսված գործիքներ. Excel- ի ավելի քան 300 հարմարավետ հավելումներով, 30 օրվա ընթացքում անվճար փորձեք առանց սահմանափակումների: Ներբեռնեք և անվճար փորձեք հիմա:

Գրասենյակի արտադրողականության լավագույն գործիքները

🤖 Kutools AI օգնականՀեղափոխություն կատարել տվյալների վերլուծության հիման վրա՝ Խելացի կատարում   |  Ստեղծեք ծածկագիր  |  Ստեղծեք հատուկ բանաձևեր  |  Վերլուծել տվյալները և ստեղծել գծապատկերներ  |  Invoke Kutools-ի գործառույթները...
Հանրաճանաչ հատկություններ: Գտեք, ընդգծեք կամ նույնականացրեք կրկնօրինակները   |  Deleteնջել դատարկ շարքերը   |  Միավորել սյունակները կամ բջիջները՝ առանց տվյալների կորստի   |   Կլոր առանց բանաձևի ...
Super Փնտրել: Բազմաթիվ չափանիշների VLookup    Բազմակի արժեք VLookup  |   VLookup բազմաթիվ թերթերում   |   Fuzzy Փնտրել ....
Ընդլայնված բացվող ցուցակ: Արագ ստեղծեք բացվող ցուցակը   |  Կախված բացվող ցուցակ   |  Բազմակի ընտրություն Drop Down ցուցակ ....
Սյունակի կառավարիչ: Ավելացրեք որոշակի քանակությամբ սյունակներ  |  Տեղափոխել սյունակները  |  Փոխարկել թաքնված սյունակների տեսանելիության կարգավիճակը  |  Համեմատեք միջակայքերը և սյունակները ...
Առանձնահատկություններ: Ցանցի կենտրոնացում   |  Դիզայնի տեսք   |   Մեծ Formula Bar    Աշխատանքային գրքույկի և թերթիկների կառավարիչ   |  Ռեսուրսների գրադարան (Ավտոմատ տեքստ)   |  Ամսաթիվ ընտրող   |  Միավորել աշխատանքային թերթերը   |  Գաղտնագրել/գաղտնազերծել բջիջները    Ուղարկեք նամակներ ըստ ցանկի   |  Սուպեր զտիչ   |   Հատուկ զտիչ (զտել թավ/շեղ/շեղված...) ...
Լավագույն 15 գործիքների հավաքածու12 Տեքստ Գործիքներ (Ավելացրեք տեքստ, Հեռացնել նիշերը, ...)   |   50+ Աղյուսակ Տեսակներ (Գանտի աղյուսակը, ...)   |   40+ Գործնական Բանաձեւեր (Հաշվարկել տարիքը ՝ ելնելով ծննդյան տարեդարձից, ...)   |   19 միացում Գործիքներ (Տեղադրեք QR կոդ, Տեղադրեք նկար ուղուց, ...)   |   12 Փոխարկում Գործիքներ (Բառեր համարներ, Արտարժույթի փոխակերպումը, ...)   |   7 Միաձուլում և պառակտում Գործիքներ (Ընդլայնված կոմբինատ տողեր, Պառակտված բջիջներ, ...)   |   ... եւ ավելին

Լրացրեք ձեր Excel-ի հմտությունները Kutools-ի հետ Excel-ի համար և փորձեք արդյունավետությունը, ինչպես երբեք: Kutools-ը Excel-ի համար առաջարկում է ավելի քան 300 առաջադեմ առանձնահատկություններ՝ արտադրողականությունը բարձրացնելու և ժամանակ խնայելու համար:  Սեղմեք այստեղ՝ Ձեզ ամենաշատ անհրաժեշտ հատկանիշը ստանալու համար...

Նկարագրություն


Office Tab- ը Tabbed ինտերֆեյսը բերում է Office, և ձեր աշխատանքը շատ ավելի դյուրին դարձրեք

  • Միացնել ներդիրներով խմբագրումը և ընթերցումը Word, Excel, PowerPoint- ով, Հրատարակիչ, Access, Visio և Project:
  • Բացեք և ստեղծեք բազմաթիվ փաստաթղթեր նույն պատուհանի նոր ներդիրներում, այլ ոչ թե նոր պատուհաններում:
  • Բարձրացնում է ձեր արտադրողականությունը 50%-ով և նվազեցնում մկնիկի հարյուրավոր սեղմումները ձեզ համար ամեն օր:
Comments (19)
Rated 5 out of 5 · 2 ratings
This comment was minimized by the moderator on the site
Como faço para ajustar a função do "MultipleValues" para ignorar células vazias?

Pois no meu caso tenho algumas células em branco e quando faço o merge, fico com algumas vírgulas repetidas.

Ex.: (001,002,,,,003).

Obrigado!
This comment was minimized by the moderator on the site
Hello, Bruno,
To ignore the blank cells when combine, pleae apply the following code:

Function SingleCellExtract(LookupValue As String, LookupRange As Range, ColumnNumber As Integer, Char As String) As String
    Dim I As Long
    Dim xRet As String
    For I = 1 To LookupRange.Columns(1).Cells.Count
        If LookupRange.Cells(I, 1) = LookupValue Then
            ' Check if the cell in the specified column is not empty before appending
            If Not IsEmpty(LookupRange.Cells(I, ColumnNumber)) Then
                If xRet = "" Then
                    xRet = LookupRange.Cells(I, ColumnNumber) & Char
                Else
                    xRet = xRet & LookupRange.Cells(I, ColumnNumber) & Char
                End If
            End If
        End If
    Next
    If Len(xRet) > 0 Then
        SingleCellExtract = Left(xRet, Len(xRet) - 1)
    Else
        SingleCellExtract = ""
    End If
End Function


Please have a try, hope it can help you!
This comment was minimized by the moderator on the site
Hello skyyang,

Yes, it works!

Thank you!
This comment was minimized by the moderator on the site
No soy programador pero necesito ayuda para que la función de abajo en lugar de devolverme esto

S-01-08-0017->Micro Post 1R, Black, Stainless Steel -End,->4;S-01-08-0057->Micro Post 2R, Black, Stainless Steel -End,->2

me devuelva los valores en líneas diferentes.
S-01-08-0017->Micro Post 1R, Black, Stainless Steel -End,->4
S-01-08-0057->Micro Post 2R, Black, Stainless Steel -End,->2

La función es:
Function SingleCellExtract(LookupValue As String, LookupRange As Range, ColumnNumber As Integer, Char As String)
'Updateby Extendoffice
Dim I As Long
Dim xRet As String
For I = 1 To LookupRange.Columns(1).Cells.Count
If LookupRange.Cells(I, 1) = LookupValue Then
If xRet = "" Then
xRet = LookupRange.Cells(I, ColumnNumber) & Char
Else
xRet = xRet & "" & LookupRange.Cells(I, ColumnNumber) & Char
End If
End If
Next
SingleCellExtract = Left(xRet, Len(xRet) - 1)
End Function
This comment was minimized by the moderator on the site
Hello, Yery,
Did you mean to split a cell into multiple rows based on the semicolon character?
If so, the following VBA code can help you:
Sub SplitAll()
    Dim xRg As Range
    Dim xRg1 As Range
    Dim xCell As Range
    Dim I As Long
    Dim xAddress As String
    Dim xUpdate As Boolean
    Dim xRet As Variant
    On Error Resume Next
    xAddress = Application.ActiveWindow.RangeSelection.Address
    Set xRg = Application.InputBox("Please select a range", "Kutools for Excel", xAddress, , , , , 8)
    Set xRg = Application.Intersect(xRg, xRg.Worksheet.UsedRange)
    If xRg Is Nothing Then Exit Sub
        If xRg.Columns.Count > 1 Then
            MsgBox "You can't select multiple columns", , "Kutools for Excel"
            Exit Sub
            End If
            Set xRg1 = Application.InputBox("Split to (single cell):", "Kutools for Excel", , , , , , 8)
            Set xRg1 = xRg1.Range("A1")
            If xRg1 Is Nothing Then Exit Sub
                xUpdate = Application.ScreenUpdating
                Application.ScreenUpdating = False
                For Each xCell In xRg
                    xRet = Split(xCell.Value, ";")
                    xRg1.Worksheet.Range(xRg1.Offset(I, 0), xRg1.Offset(I + UBound(xRet, 1), 0)) = Application.WorksheetFunction.Transpose(xRet)
                    I = I + UBound(xRet, 1) + 1
                Next
                Application.ScreenUpdating = xUpdate
            End Sub

Please have a try, hope it can help you!
This comment was minimized by the moderator on the site
Hi,

I want exact validation code for multiple values separated by comma and space for each value.

Example:
Lucy, Tom, Nicol, Akash, Apple

Please replay if you have any suggestions.
Rated 4.5 out of 5
This comment was minimized by the moderator on the site
Hello, Manikanta
To separate the multiple values by a comma and space, you just need to add a space behind the comma, change the formula as this: =SingleCellExtract(D2,A2:B15,2,", ").
Please try, hope it can help you!
This comment was minimized by the moderator on the site
Hi Skyyang,

Thanks for your replay!

I tried already same way but in the cell value last one extra comma (,) coming below is the example.

Lucy, Tom, Nicol, Akash, Apple,

This will not work for Json file, so I want values separated by comma and space like below.

Lucy, Tom, Nicol, Akash, Apple

Thank you!
This comment was minimized by the moderator on the site
Hello, Manikanta
In this case, you can apply the below User Defined Function:

Function MultipleValues(work_range As Range, criteria As Variant, merge_range As Range, Optional Separator As String = ",") As Variant
Dim outcome As String
On Error Resume Next
If work_range.Count <> merge_range.Count Then
MultipleValues = CVErr(xlErrRef)
Exit Function
End If
For i = 1 To work_range.Count
If work_range.Cells(i).Value = criteria Then
outcome = outcome & Separator & merge_range.Cells(i).Value
End If
Next i
If outcome <> "" Then
outcome = VBA.Mid(outcome, VBA.Len(Separator) + 1)
End If
MultipleValues = outcome
Exit Function
End Function


After pasting the code, please use this formula: =MultipleValues($A$2:$A$15,D2,$B$2:$B$15,", ")

Please try, hope this can help you!
If you still have any other problem, please comment here.
https://www.extendoffice.com/images/stories/comments/comment-skyyang/doc-return-multiple-matching-1.png
This comment was minimized by the moderator on the site
Hi Skyyang,

This is working now, Thank you for your quick response.

It's very use full to me once again Thank you for your help.

Regards,
Manikanta.
Rated 5 out of 5
This comment was minimized by the moderator on the site
Good Morning,

the VBA code worked perfectly with my worksheet, pretty clear and simple, however, I was trying to find a way to tell excel to only return the unique values. Would that be possible using this same code?
Rated 5 out of 5
This comment was minimized by the moderator on the site
When 2 Criteria Match then Return Multiple Lookup Values In One Comma Separated Cell
A2=B2 Then Result From Range by "SingleCellExtract" - Please.......
This comment was minimized by the moderator on the site
Error pops up if increase the array size
This comment was minimized by the moderator on the site
VB command breaks when the range is longer than 154 rows (ie :B154)....
This comment was minimized by the moderator on the site
thank you, firstly i managed to get this to work without the slow down in performance. I'm using values rather that text so my question is i want to bring back all those with less than say 19 points in a list. Can the single cell Extract work for that or does it have to be a specific value?
This comment was minimized by the moderator on the site
This simply does not work. I was unable to get it to work in my own application, so I copy/pasted the vba and the formula and it returned an error every time
This comment was minimized by the moderator on the site
This works but slows down my excel majorly! Any tips to help speed?
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