VLOOKUP formula error

phmalu

Board Regular
Joined
Jun 21, 2017
Messages
52
Office Version
  1. 2019
Platform
  1. Windows
Hi all,

Can you guys try to figure out what's wrong with my formula? Maybe VLOOKUP is not the best function in my case once the desired result will always be in column A but I really don't know what else to try.


Ew4wm1b.png


=IF(H4=B3;VLOOKUP(I4;A4:D9;2;FALSE);IF(H4=C3;VLOOKUP(I4;A4:D9;3;FALSE);IF(H4=D3;VLOOKUP(I4;A4:D9;4;FALSE))))

Thanks to all!
 

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
VLOOKUP can't return values to the left.
Try:
Excel Workbook
ABCDEFGHIJ
1
2
3Reading100020003000
41000.000.000.0010002150
51502.003.005.00
62002.103.105.10
72504.006.0010.00
83004.106.1010.10
93506.009.0015.00
Sheet
 
Upvote 0
The category values appears to be sorted in ascending order. If we need to return 150, also for 2.05 while category = 1000, an approximate match is required:

Either...
=INDEX($A$4:$A$9,MATCH(I4,INDEX($B$4:$D$9,0,MATCH($H$4,$B$3:$D$3,0)),1))

Or…
=LOOKUP(I4,INDEX($B$4:$D$9,0,MATCH(H4,$B$3:$D$3,0)),$A$4:$A$9)
 
Upvote 0
In your case, INDEX-MATCH might be a better fit.

=IF(H4=B3,INDEX(A4:A9,MATCH(I4,B4:B9,0)),IF(H4=C3,INDEX(A4:A9,MATCH(I4,C4:C9,0)),IF(H4=D3,INDEX(A4:A9,MATCH(I4,D4:D9,0)),"No Result")))
 
Upvote 0
VLOOKUP can't return values to the left.
Try:
ABCDEFGHIJ
1
2
3Reading100020003000
41000.000.000.0010002150
51502.003.005.00
62002.103.105.10
72504.006.0010.00
83004.106.1010.10
93506.009.0015.00

<colgroup><col style="width: 30px;"><col style="width: 64px;"><col style="width: 64px;"><col style="width: 64px;"><col style="width: 64px;"><col style="width: 23px;"><col style="width: 22px;"><col style="width: 16px;"><col style="width: 64px;"><col style="width: 51px;"><col style="width: 64px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
J4=INDEX($A$4:$A$9,MATCH(I4,INDEX($B$4:$D$9,0,MATCH($H$4,$B$3:$D$3,0)),0))

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4


It worked but the final result was simply "TRUE" not the value on the "Reading" column :(.
 
Last edited:
Upvote 0
What about Category = 1000 and Value = 2,05?

Intermediary values are not important in my case, the raw data will be converted first so it fits the exact pre-defined values.
Btw, this is just a hypothetical example I came across, not the real data I'm using. But the main problem now is that all the possible formulas you guys posted are simply returning "TRUE". None of them actually worked and returned the value on the "Reading" column. And I really don't know why :(.
 
Upvote 0
Intermediary values are not important in my case, the raw data will be converted first so it fits the exact pre-defined values.
Btw, this is just a hypothetical example I came across, not the real data I'm using. But the main problem now is that all the possible formulas you guys posted are simply returning "TRUE". None of them actually worked and returned the value on the "Reading" column. And I really don't know why :(.

Nvm, not sure what was going on earlier but I was able to make it work this time. Apparently the combination of Index + match is very powerful so I'm going to research a bit about it and learn how to set up those formulas by my own. I'm pretty sure I'll be needing them in the near future.

Thank you very much!!
 
Upvote 0
Intermediary values are not important in my case, the raw data will be converted first so it fits the exact pre-defined values.
Btw, this is just a hypothetical example I came across, not the real data I'm using. But the main problem now is that all the possible formulas you guys posted are simply returning "TRUE". None of them actually worked and returned the value on the "Reading" column. And I really don't know why :(.


AhoyNC suggested a formula that does exact match and returns the corresponding Reading value if that exists:

=INDEX($A$4:$A$9,MATCH(I4,INDEX($B$4:$D$9,0,MATCH($H$4,$B$3:$D$3,0)),0))
 
Upvote 0

Forum statistics

Threads
1,215,575
Messages
6,125,632
Members
449,241
Latest member
NoniJ

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