How to check if a cell value is between two values in Excel?


We have two numbers and a value, and we want to determine whether or not the value is in between the two numbers that we have been provided. In order to proceed with this topic, we need to utilise the AND logical operator in a way that satisfies both of the prerequisites. The AND logical operator examines a number of circumstances and returns the value TRUE only if all of those conditions are met; otherwise, it returns the value FALSE.

The two conditions that required to be checked are as follows: the value must be greater than the smaller of the numbers, and it must also be less than the bigger of the numbers. In order to accomplish this, we will make use of Excel's MIN and MAX functions.

Checking If a Cell Value is Between Two Values Using the AND Function

Let's see how this works by looking at the example down below.

Step 1

In the first step, we must create one sample data. Refer the screenshot below.

Step 2

In this spreadsheet, the two numbers that were provided are located in columns A and B, and the value that needs to be verified is located in column C. As shown in the below screenshot.

Step 3

Now, enter the formula into a cell that is blank, which would be cell D2 in this example. Refer to the below screenshot for same.

Formula

=AND(C2>MIN(A2,B2),C2<MAX(A2,B2))

Note − Make sure that both of these conditions are met.

  • The value is higher than the number that is the less significant of the two.

  • The lesser of the two numbers has a higher value than the greater of the two numbers.

In this case, the MAX & MIN function will return the value that is the greatest as well as the minimum of the two values. AND functions check both conditions and only return "True" if both statements can be proven to be correct; otherwise, they return "False."

Step 4

After that, you will get a new column, press the Enter key, and drag the fill handle to the range that you want to use, as demonstrated in the screenshot below. As you can see, the formula gives a result of True if the value is found to fall in the middle of the two integers; otherwise, it gives a result of False.

Conclusion

In this tutorial, we used a simple example to demonstrate how you can check if a cell value is between two values in Excel.

Updated on: 08-Feb-2023

337 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements