lookup multiple column

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
Can I do multiple column Vlookup. I searched the internet but most of examples are using Match-Index. I want to learn multiple Vlookup first then I will go to match-index. I am thinking of array function but do not know how to start

I have the table below. I want to do the following

Enter Name: John
Enter Item: Milk

Then excel will return 32

or excel will return 2 values the amount and date, so it will be 32 and mar

Is that possible? Thank you so much

nameitemamountmonth
marymilk59feb
marywater75jan
maryjuice61feb
johnmilk32mar
johnwater1feb
jonjuice73jan
alexmilk60feb
alexwater16mar
alexjuice93feb
lindamilk63jan
lindawater19feb

<colgroup><col><col span="3"></colgroup><tbody>
</tbody>
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Book1
ABCDEF
1nameitemamountmonthjohn
2marymilk59febmilk
3marywater75jan
4maryjuice61feb32
5johnmilk32marmar
6johnwater1feb
7jonjuice73jan
8alexmilk60feb
9alexwater16mar
10alexjuice93feb
11lindamilk63jan
12lindawater19feb
Sheet1


Control+shift+enter…

=VLOOKUP(F1&"|"&F2,CHOOSE({1,2},$A$2:$A$12&"|"&$B$2:$B$12,$C$2:$C$12),2,0)

=VLOOKUP(F1&"|"&F2,CHOOSE({1,2},$A$2:$A$12&"|"&$B$2:$B$12,$D$2:$D$12),2,0)
 
Upvote 0
Thank you very much for your reply. Lets say I have a table like below.

So the user will enter the name and excel will return Amount and month
So I selected 2 cells (because I am expecting 2 values to be returned) then I typed the following in the first cell:

=VLOOKUP(A2,$A$1:$D$13,{3,4},FALSE)

and then pressed ctr+Shift+enter

But excel only returned the amount to me, 80, not the month?

How can I fix that. Thanks once again.

nameitemamountmonth
mary1milk80jan
mary2water15feb
mary3juice54mar
mary4milk97mar
mary5water97jan
mary6juice79jan
mary7milk48feb
mary8water87mar
mary9juice14mar
mary10milk48jan
mary11water73jan
mary12juice18feb

<colgroup><col width="64" span="4" style="width:48pt"> </colgroup><tbody>
</tbody>
 
Upvote 0
Let F1 = mary1

In G1 control+shift+enter:

=VLOOKUP(F2,$A$2:$D$13,{3,4},0)

Since VLOOKUP cannot display two results in a single cell, you just see 80.

Select the formula in the formula bar and hit F9. You'll see:

{80,"jan"}

To display these values in 1 cell, try the following: Conrol+shift+enter...

=TEXTJOIN("; ",TRUE,VLOOKUP(F2,$A$2:$D$13,{3,4},0))
 
Upvote 0
So I selected 2 cells (because I am expecting 2 values to be returned) then I typed the following in the first cell:

=VLOOKUP(A2,$A$1:$D$13,{3,4},FALSE)

and then pressed ctr+Shift+enter

But excel only returned the amount to me, 80, not the month?

That will work if you're selecting a horizontal range of two cells. If you're selecting a vertical range of two cells, however, you need:

=VLOOKUP(A2,$A$1:$D$13,{3;4},FALSE)

or, if you're not using an English-language version of Excel, whatever the vertical separator within array constants is for your locale.

Regards
 
Upvote 0
Thank you once again. I have 2 table like below. I selected 3 cells (C1:C3) and then I typed the following in cells C1


=A1:A3-B1:B3 (ctrt+alt+ent)


and I got the right answer in c1 to c3.


If I can do that, then why I can not do the same using Vlookup? Why I need TextJoin() function. Thank you very much.

14-3
25-3
36-3

<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>
</tbody>
 
Upvote 0
Thank you once again. I have 2 table like below. I selected 3 cells (C1:C3) and then I typed the following in cells C1


=A1:A3-B1:B3 (ctrt+alt+ent)


and I got the right answer in c1 to c3.


If I can do that, then why I can not do the same using Vlookup? Why I need TextJoin() function. Thank you very much.

14-3
25-3
36-3

<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>
</tbody>


We can use consecutive cells (instead of 1 cell TEXTJOIN creates)...

F2 = mary1

In G2 control+shift+enter, not just enter, and copy across:

=IFERROR(INDEX(VLOOKUP($F2,$A$2:$D$13,{3,4},0),COLUMNS($G2:G2)),"")

This puts the retrieved values in consecutive cells.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,264
Members
449,075
Latest member
staticfluids

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