Index match with multiple value

SAXON10

Board Regular
Joined
Jun 1, 2017
Messages
109
Hi,

Index match with multiple value in same cell without duplication. In sheet 1 column A contain the range A2:A12 of code and column B contain

the range B2:B12 of text. In Sheet 2 column A&B is code and result.

I am apply the following array formula in sheet2 but I got some error.

=CHOOSE(SUMPRODUCT(--($A2=DATA!A2:$A$12)),VLOOKUP($A2,DATA!$A$2:$B$12,2,0),VLOOKUP($A2,DATA!$A$2:$B$12,2,0)&","&INDEX(DATA!$B$2:$B$12,MATCH($A2,DATA!$A$2:$A$12,0)+1),VLOOKUP($A2,DATA!$A$2:$B$12,2,0)&","&INDEX(DATA!$B$2:$B$12,MATCH($A2,DATA!$A$2:$A$12,0)+1)&","&INDEX(DATA!$B$2:$B$12,MATCH($A2,DATA!$A$2:$A$12,0)+2))

Any help much appreciated.

Sheet2

CODEDESIRED REDULT
11-JPLL01,LL06
5556-PPX21,X25
888-TRTR01,TR11

<colgroup><col><col></colgroup><tbody>
</tbody>

Sheet1

CODETEXT
11-JPLL06
11-JPLL06
11-JPLL06
11-JPLL01
888-TRTR11
5556-PPX25
5556-PPX21
5556-PPX21
888-TRTR11
11-JPLL01
888-TRTR01

<colgroup><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
alternatively you can try PowerQuery

Code:
let
    Source = Table.NestedJoin(Table2,{"CODE"},Table1,{"CODE"},"Table1",JoinKind.LeftOuter),
    #"Expanded Table1" = Table.ExpandTableColumn(Source, "Table1", {"TEXT"}, {"TEXT"}),
    #"Grouped Rows" = Table.Group(#"Expanded Table1", {"CODE"}, {{"Count", each _, type table}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Result", each List.Sort(List.Distinct(Table.Column([Count],"TEXT")),Order.Ascending)),
    #"Extracted Values" = Table.TransformColumns(#"Added Custom", {"Result", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
    #"Removed Columns" = Table.RemoveColumns(#"Extracted Values",{"Count"}),
    #"Sorted Rows" = Table.Sort(#"Removed Columns",{{"CODE", Order.Ascending}})
in
    #"Sorted Rows"

CODETEXTCODECODEResult
11-JPLL0611-JP11-JPLL01,LL06
11-JPLL065556-PP5556-PPX21,X25
11-JPLL06888-TR888-TRTR01,TR11
11-JPLL01
888-TRTR11
5556-PPX25
5556-PPX21
5556-PPX21
888-TRTR11
11-JPLL01
888-TRTR01
 
Upvote 0
Hi

I may have a formula solution for you.

Copy your data table in A1:B12, including the table headings

Enter the following formula in C2 and fill it down to C2
=COUNTIFS($A$2:A2,A2)

Enter the following array formula by pressing Shift + Control + Enter and fill it down to D12

=IF(C2=1,INDEX($B$2:$B$12,MATCH(A2,$A$2:$A$12,0)),INDEX($D1:D$1,MATCH(1,((C2-1)=$C$1:C1)*(A2=$A$1:A1),0))&";"&B2)

Copy your lookup values in A15:A17 as listed below
11-JP
5556-PP
888-TR

Enter the following formula B15 and fill it down to B17

=INDEX($D$2:$D$12,SUMPRODUCT((MAX(ROW($D$2:$D$12)*(A15=$A$2:$A$12))-1)))

Kind regards

Saba
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,602
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top