VLOOKUP from two columns, return first values which you find

Manojlo

New Member
Joined
Sep 4, 2020
Messages
42
Office Version
  1. 365
Platform
  1. Windows
I would like in column F to have values from columns B and D depend on unique values (car name) from column E.
Idea is to search for car models in column A and C, and than return first value (color) encountered. Like is on example.

1653140965141.png
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Try:
=XLOOKUP(E2,$A$2:$A$14,$B$2:$B$14,XLOOKUP(E2,$C$2:$C$14,$D$2:$D$14,"No Match",0,1),0,1)
 
Upvote 0
Solution
In future, sample data/results with XL2BB would be helpful.

If you have the VSTACK function (not all 365 users have it yet but it is [slowly] being rolled out) ..

22 05 22.xlsm
ABCDEF
1
2LincolnRedSkodaRedLincolnRed
3LincolnBlueSmartPinkMaybachBlue
4LincolnRedSmartOrangeMcLarenOrange
5MaybachBlueSuzukiPurpleNissanYellow
6MaybachPinkSuzukiPurpleOpelYellow
7McLarenOrangeSuzukiOrangeSkodaBlue
8McLarenYellowSubaruYellowSmartPink
9McLarenYellowSubaruYellowSuzukiPurple
10NissanYellowToyotaYellowSubaruYellow
11NissanYellowToyotaRedToyotaYellow
12OpelYellowSubaruRedTeslaRed
13SkodaBlueTeslaRed
14SkodaBlueTeslaBrown
VSTACK
Cell Formulas
RangeFormula
E2:E12E2=UNIQUE(VSTACK(A2:A14,C2:C14))
F2:F12F2=VLOOKUP(E2#,VSTACK(A2:B15,C2:D15),2,0)
Dynamic array formulas.
 
Upvote 0
I don't have VSTACK function.
Fair enough. But if you adapt the suggestion from your other thread to create the unique list with a single formula in a single cell then you can also use the VLOOKUP formula from above just in a single cell without the need to copy either formula down the column.

22 05 22.xlsm
ABCDEF
1
2LincolnRedSkodaRedLincolnRed
3LincolnBlueSmartPinkMaybachBlue
4LincolnRedSmartOrangeMcLarenOrange
5MaybachBlueSuzukiPurpleNissanYellow
6MaybachPinkSuzukiPurpleOpelYellow
7McLarenOrangeSuzukiOrangeSkodaBlue
8McLarenYellowSubaruYellowSmartPink
9McLarenYellowSubaruYellowSuzukiPurple
10NissanYellowToyotaYellowSubaruYellow
11NissanYellowToyotaRedToyotaYellow
12OpelYellowSubaruRedTeslaRed
13SkodaBlueTeslaRed
14SkodaBlueTeslaBrown
VSTACK (3)
Cell Formulas
RangeFormula
E2:E12E2=UNIQUE(FILTERXML("<a><b>"&TEXTJOIN("</b><b>",,A2:A14,C2:C14)&"</b></a>","//b"))
F2:F12F2=VLOOKUP(E2#,VSTACK(A2:B15,C2:D15),2,0)
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

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