Home > Net >  VLOOKUP 4th parameter
VLOOKUP 4th parameter

Time:01-31

I need clarification on using the fourth parameter in the VLOOKUP function. I understand it is meant for an exact or close match.

How does Excel derive the closest match?

For example, My range has values: 1111 1234 1236 2222

If the value I am comparing is 1235. Will I get the closest match as 1234 or 1236, and why?

CodePudding user response:

It will return 1234 as that was the last number lower or equal to the input.

enter image description here

Note that TRUE requires that the lookup values be sorted ascending otherwise it will return the wrong value as it will stop as soon as it finds where the value goes from lower to higher.

For example if your data was in this order: {1111,2222,1234,1236} your search of 1235 would return 1111

enter image description here

One more note, XLOOKUP does not have the same restriction as you can decide whether you want the exact or next smaller or exact or next larger. Which means it can be sorted how ever and it will return either 1234 or 1236 depending on the choice.

enter image description here

Here the -1 tells the XLOOKUP I want the Exact or next smaller.

  • Related