look up values horizontally

Urbanx

New Member
Joined
Sep 5, 2019
Messages
1
Hi All, have a question.


In C column I have my product serials. I want to look for them in column A and if they have a match I want the City names in D3, E3, F3 etc. So I want them horizontally.

Tried to to it with index and match, managed to do one line but then were not able to pull it down because of the $ signs were "fixing" C3 cell.

I just coloured some cells to make it easy to see what I want.

Vlookup obviously brings up only the very first match I need all of them.

Could you help me please?

Untitled44.png
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Edited as I forgot the restriction with pasting chevrons in HTML.

If I interpret your request correctly then this should work. You need to copy right the maximum number of cities per serial.

The COUNTIF returns null when you've exhausted matching cities for a serial.

The INDEX returns the city from the row which the...
AGGREGATE has returned as it uses the SMALL function returning the 1st, 2nd, 3rd etc. across the COLUMNS frrom D where there's a matching serial.

ABCDEFG
1SerialsLocation NameSerialsLocation 1Location 2Location 3Location 4
212345Munich44332MunichHamburg
344332Munich83838MunichBerlin
483838Munich12345MunichBerlinHamburg
592929Munich
612345Berlin
783838Berlin
892929Berlin
912345Hamburg
1044332Hamburg
1192929Hamburg

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
D2
=IF(COUNTIF($A$2:$A$11,$C2) < COLUMNS($D$1:D$1),"",INDEX($B$2:$B$11,AGGREGATE(15,6,ROW($A$2:$A$11)-ROW($A$1)/($A$2:$A$11=$C2),COLUMNS($D$1:D$1))))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Last edited:
Upvote 0
Similar to Toadstool.

=IFERROR(INDEX($B$2:$B$11,AGGREGATE(15,6,(ROW($B$2:$B$11)-ROW($B$2)+1)/($A$2:$A$11=$C2), COLUMNS($A$1:A$1))),"")
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,583
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