Forum Discussion
Help Vlookup formula with criteria
- Aug 02, 2020
If I may, I think the problem is that the MIN function is evaluating all of the rate differences and not just the rate differences for the selected country.
I think it just needs a little tweak. Try this in H4 (copied down):
=INDEX($C$4:$C$9, MATCH(1,ISNUMBER(SEARCH($E4,$B$4:$B$9))*(ABS($C$4:$C$9-$G4)=MIN(IF(ISNUMBER(SEARCH($E4,$B$4:$B$9)),ABS($C$4:$C$9-$G4),""))),0))
Another way is...
=INDEX($C$4:$C$9,MATCH(MIN(IF(ISNUMBER(SEARCH(E4,$B$4:$B$9)),ABS($C$4:$C$9-G4))),INDEX((ISNUMBER(SEARCH(E4,$B$4:$B$9)))*(ABS($C$4:$C$9-G4)),),0))I believe you will have a problem if the charge/unit happens to match the price per min. Since the difference is zero, it will match to the first zero.Subodh_Tiwari_sktneer
- Subodh_Tiwari_sktneerAug 03, 2020Silver Contributor
- JMB17Aug 03, 2020Bronze Contributor
I get a different answer by changing the charge/unit to 21.87. Is the charge/unit in your screencap 21.87 or just formatted to show 2 decimals?
If the charge/unit is the same as the price per min for the applicable country, then the min value for that country is zero. Then MATCH will match to the first zero in the second argument, which may/may not be correct as the values for the other countries will be zero as well.
- Subodh_Tiwari_sktneerAug 03, 2020Silver Contributor
Ah... you are right. Thanks for pointing that out.