vlookup column 2 but return column 1

rfletcher35

Active Member
Joined
Jul 20, 2011
Messages
300
Office Version
  1. 365
Platform
  1. Windows
I'm adding a search to my workbook based on a drop down list of 4 criteria. I've managed to pretty much do this using the offset command in my formulas. But if my VLOOKUP searches on columns 2,3,or 4 how can I do it so it also returns the value in column 1 in the cell I need?

=IFERROR(VLOOKUP(B5,OFFSET(STOCK,0,1),1,0),"") is what I have that returns what I have searched for in column2 of my range
What do I need to return the value of column 1 that corresponds with the data in column 2?

Any ideas please

Fletch
 
From the screen caps, the only thing that looks at though it might be wrong is one of the references in bold below, should both be the same?

=IFERROR(INDEX(Data!$J$4:$J$2000,MATCH(R33,Data!$K$4:$K$2000,0)),IFERROR(INDEX(Data!$J$4:$J$2000,MATCH(B5,Data!$L$4:$L$2000,0)),""))

Yes I did see that after posting, they should both be R33 and I have changed that but it still produces nothing unless I have the Asset in the box
 
Upvote 0

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Yes I did see that after posting, they should both be R33 and I have changed that but it still produces nothing unless I have the Asset in the box
I even tried CTRL+SHIFT+ENTER to make it an array formula but that made no difference
 
Upvote 0
Your formula works for me (different sample data)

20 05 24.xlsm
JKL
3AssetTag
47018ah
57019bi
67020c5X7H322
77021dk
87022el
97023fm
107024gn
Data


20 05 24.xlsm
RS
335X7H3227020
Lookup
Cell Formulas
RangeFormula
S33S33=IFERROR(INDEX(Data!$J$4:$J$2000,MATCH(R33,Data!$K$4:$K$2000,0)),IFERROR(INDEX(Data!$J$4:$J$2000,MATCH(R33,Data!$L$4:$L$2000,0)),""))
 
Upvote 0
Could it be that your Tag values have trailing spaces or other non-visible characters. Try over-typing the value from R33 manually into one of the column L cells (or copy/paste)
 
Upvote 0
Your formula works for me (different sample data)

20 05 24.xlsm
JKL
3AssetTag
47018ah
57019bi
67020c5X7H322
77021dk
87022el
97023fm
107024gn
Data


20 05 24.xlsm
RS
335X7H3227020
Lookup
Cell Formulas
RangeFormula
S33S33=IFERROR(INDEX(Data!$J$4:$J$2000,MATCH(R33,Data!$K$4:$K$2000,0)),IFERROR(INDEX(Data!$J$4:$J$2000,MATCH(R33,Data!$L$4:$L$2000,0)),""))


I just cut and paste your formula in and it does work, I can only assume there was a small difference in mine somewhere?

Thanks so much for your help Peter

Fletch
 
Upvote 0
I just cut and paste your formula in and it does work
Good news.


I can only assume there was a small difference in mine somewhere?
All I did was copy/paste your formula from the forum to my sheet and change B5 to R33. Perhaps you didn't post the exact offending formula from your sheet?

Anyway, main thing is that it is working now. :)
 
Upvote 0
I just cut and paste your formula in and it does work, I can only assume there was a small difference in mine somewhere?

Thanks so much for your help Peter

Fletch

Any ideas the best way to do this using both sets of data?
 
Upvote 0
Can you explain how both sets of data relate (or not) to each other?

What, exactly, are you trying to do?
 
Upvote 0
Sorted it, Bit messy but none the less sorted it.

=IFERROR(INDEX(Data!$J$4:$J$2000,MATCH(R33,Data!$K$4:$K$2000,0)),IFERROR(INDEX(Data!$J$4:$J$2000,MATCH(R33,Data!$L$4:$L$2000,0)),IFERROR(INDEX(Data!$Q$4:$Q$2000,MATCH(R33,Data!$R$4:$R$2000,0)),IFERROR(INDEX(Data!$Q$4:$Q$2000,MATCH(R33,Data!$S$4:$S$2000,0)),""))))

The first set of data is stock that we have, the second set is what has already gone to site.
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

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