Return a Value Between Two Values in a Range

Last Updated on 06/03/2025
Reading time: 2 minutes

You can return a value between two values in Excel with two functions. Both VLOOKUP and XLOOKUP are helpful when searching for approximate matches within a range.

Don't use the IF function ⛔

Many Excel users try this approach to solving this problem. It works but is not efficient. With the IF function, you must handle every case. This is called nested IF.

Nested IF to return a value between 2 values

Or, you can simply the number of parenthesis with the IFS function.

IFS function to return between 2 values

Each function returns the correct result, but there are issues:

  • Each function is difficult to create.
  • The risk of making mistakes is high.
  • Anyone unfamiliar with Excel could easily make errors when updating.

Solution #1: Search between two values with VLOOKUP

For many years, the best way to find a value between two values was to use VLOOKUP. By setting the last argument to TRUE (or 1), you can perform an approximate match. This allows you to search between values 😉. The major advantages of this approach are:

  1. You don't need to write out each condition, unlike with the IF or IFS functions.
  2. Simply select the reference table that contains all the values.
  3. The only requirement is that your reference table values must be sorted in ascending order, from smallest to largest.

How to write the VLOOKUP is this situation?

  1. lookup_value: The value you want to search for (B2)
  2. table_array: Your reference table ($E$4:$F$8)
  3. col_index_num: The column to return in the reference table (here the second column)
  4. range_lookup: TRUE for an approximate match.
VLOOKUP to return a value in a range of values

Solution #2: Use the XLOOKUP function

You can also use the XLOOKUP function. As this as been seen in this article, the XLOOKUP function provides more options than the VLOOKUP function. For instance, the XLOOKUP function can perform an approximate search in both direction (next smaller item or next larger item). And also, you lookup values don't need to be sorted 😃

XLOOKUP to search between values next smaller item

But you can also use the XLOOKUP the other way round. That means from the next larger item.

XLOOKUP to return the next larger item

Leave a Reply

Your email address will not be published. Required fields are marked *

Return a Value Between Two Values in a Range

Reading time: 2 minutes
Last Updated on 06/03/2025

You can return a value between two values in Excel with two functions. Both VLOOKUP and XLOOKUP are helpful when searching for approximate matches within a range.

Don't use the IF function ⛔

Many Excel users try this approach to solving this problem. It works but is not efficient. With the IF function, you must handle every case. This is called nested IF.

Nested IF to return a value between 2 values

Or, you can simply the number of parenthesis with the IFS function.

IFS function to return between 2 values

Each function returns the correct result, but there are issues:

  • Each function is difficult to create.
  • The risk of making mistakes is high.
  • Anyone unfamiliar with Excel could easily make errors when updating.

Solution #1: Search between two values with VLOOKUP

For many years, the best way to find a value between two values was to use VLOOKUP. By setting the last argument to TRUE (or 1), you can perform an approximate match. This allows you to search between values 😉. The major advantages of this approach are:

  1. You don't need to write out each condition, unlike with the IF or IFS functions.
  2. Simply select the reference table that contains all the values.
  3. The only requirement is that your reference table values must be sorted in ascending order, from smallest to largest.

How to write the VLOOKUP is this situation?

  1. lookup_value: The value you want to search for (B2)
  2. table_array: Your reference table ($E$4:$F$8)
  3. col_index_num: The column to return in the reference table (here the second column)
  4. range_lookup: TRUE for an approximate match.
VLOOKUP to return a value in a range of values

Solution #2: Use the XLOOKUP function

You can also use the XLOOKUP function. As this as been seen in this article, the XLOOKUP function provides more options than the VLOOKUP function. For instance, the XLOOKUP function can perform an approximate search in both direction (next smaller item or next larger item). And also, you lookup values don't need to be sorted 😃

XLOOKUP to search between values next smaller item

But you can also use the XLOOKUP the other way round. That means from the next larger item.

XLOOKUP to return the next larger item

Leave a Reply

Your email address will not be published. Required fields are marked *