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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
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

<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>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=CACACA]#CACACA[/URL] , align: center"]1[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=CACACA]#CACACA[/URL] , align: center"]2[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=CACACA]#CACACA[/URL] , align: center"]3[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=C0C0C0]#C0C0C0[/URL] "]Reading[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=C0C0C0]#C0C0C0[/URL] , align: right"]1000[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=C0C0C0]#C0C0C0[/URL] , align: right"]2000[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=C0C0C0]#C0C0C0[/URL] , align: right"]3000[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=CACACA]#CACACA[/URL] , align: center"]4[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]0.00[/TD]
[TD="align: right"]0.00[/TD]
[TD="align: right"]0.00[/TD]

[TD="align: center"]1000[/TD]
[TD="align: center"]2[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFF00]#FFFF00[/URL] , align: center"]150[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=CACACA]#CACACA[/URL] , align: center"]5[/TD]
[TD="align: right"]150[/TD]
[TD="align: right"]2.00[/TD]
[TD="align: right"]3.00[/TD]
[TD="align: right"]5.00[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=CACACA]#CACACA[/URL] , align: center"]6[/TD]
[TD="align: right"]200[/TD]
[TD="align: right"]2.10[/TD]
[TD="align: right"]3.10[/TD]
[TD="align: right"]5.10[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=CACACA]#CACACA[/URL] , align: center"]7[/TD]
[TD="align: right"]250[/TD]
[TD="align: right"]4.00[/TD]
[TD="align: right"]6.00[/TD]
[TD="align: right"]10.00[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=CACACA]#CACACA[/URL] , align: center"]8[/TD]
[TD="align: right"]300[/TD]
[TD="align: right"]4.10[/TD]
[TD="align: right"]6.10[/TD]
[TD="align: right"]10.10[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=CACACA]#CACACA[/URL] , align: center"]9[/TD]
[TD="align: right"]350[/TD]
[TD="align: right"]6.00[/TD]
[TD="align: right"]9.00[/TD]
[TD="align: right"]15.00[/TD]

</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,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

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