How to Check If a Value Is Between Two Numbers in Excel

Suppose we have the dataset of students’ exam marks below. We want to know whose mark is between 40 and 60. In this article, we will use different formulas and methods to check if the value is between the two numbers.

Excel Check if Value is Between Two Numbers

We used Microsoft 365 version, but the methods should work in other versions.


Method 1 – Using the IF Function

Steps:

  • Select cell D5 and enter the formula below:

=IF(C5>=$G$7,C5<=$G$6)

Here,

C5 = Mark of the student.

G7 = Lower limit.

G6 = Upper limit.

  • Press ENTER.

The syntax =IF(C5>=$G$7,C5<=$G$6) checks if the value of C5 lies between the values in cells G6 and G7. If the condition is met, the formula will return TRUE, else FALSE.

Using IF Function to check if value is between two numbers

  • Drag down the Fill Handle tool to copy the formula to the cells below.

Using IF Function to Check if Value is Between Two Numbers 

The result looks as below.


Method 2 – Using the AND Function

Steps:

  • Select cell D5 and enter the following formula:

=AND(C5>=$G$7, C5<=$G$6)

Here,

C5 = Mark of the student.

G7 = Lower limit.

G6 = Upper limit.

  • Press ENTER.

The syntax =AND(C5>=$G$7,C5<=$G$6) checks if the value of cell C5 lies between the values in cells G6 and G7. If the condition is met, the formula will return TRUE, else FALSE.

Implementing AND Function to Find Out Value Between Two Numbers

  • Drag down the formula to the rest of the cells using the Fill Handle.

The correct results are returned.


Method 3 – Combining the IF and AND Functions

Steps:

  • Enter the following formula in cell D5:

=IF(AND(C5>=$G$6,C5<=$G$5),”Yes”,”NO”)

C5 = Mark of the student.

G7 = Lower limit.

G6 = Upper limit.

  • Press ENTER.

Formula Breakdown:

AND(C5>=$G$6,C5<=$G$5)→checks whether the value of C5 lies between the values in cell G5 and G6.

IF(AND(C5>=$G$6,C5<=$G$5),”Yes”,”NO”)→If the condition is met then it will return YES else it will return NO.

Using IF and AND Functions to Check If Value Is Between Two Numbers

  • Drag down the formula for other cells.

The result will look like below.

Read More: If a Value Lies Between Two Numbers Then Return Result in Excel


Method 4 – Using AND, MIN, and MAX Functions

We can use the AND, MIN, and MAX functions to set a limit of a maximum value and minimum value range, then check if a value is between them.

Steps:

  • Select cell E5 and enter the following formula:

=AND(D5>=MIN(B5,C5),D5<=MAX(B5,C5))

Here,

B5 = Start Mark.

C5 = End Mark.

D5 = Obtained Mark.

  • Press ENTER.

Formula Breakdown:

AND(D5>=MIN(B5,C5),D5<=MAX(B5,C5))→checks if the value of D5 is between the minimum value of B5 and C5 and the maximum value of B5 and C5. If the condition is met, it will return TRUE else FALSE.

Using AND, MIN, MAX Function to Check Value Is Between Two Numbers

  • Drag down the formula to the rest of the cells with the Fill Handle.


Method 5 – Using Conditional Formatting to Highlight If a Value Is Between Two Numbers

The Conditional Formatting feature can be used to check if a value is between two numbers, then format the cells that match the condition with color to highlight them.

Steps:

  • In cell D5 enter the following formula.

=AND(C5>=$G$7, C5<=$G$6)

Applying Conditional Formatting to check if value is between two numbers

  • Press ENTER.
  • Drag down the Fill Handle to fill the other cells.
  • Select the entire cell range D5:D11.
  • Go to the Home tab >> click Conditional Formatting >> select New Rule.

Applying Conditional Formatting

A dialog box will appear.

  • Click Use a formula to determine which cells to format.
  • In the Format values where this formula is true box, enter the above formula.
  • Click Format.

A new dialog wizard will open.

  • Select Fill >> Select a color >> Click OK.

Applying Conditional Formatting

  • Click Format.

Applying Conditional Formatting

Our result will look like the screenshot below.


Download Practice Workbook

Check Value Between Two Numbers.xlsx


Related Articles


<< Go Back to Excel IF Function | Excel Functions | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Fahim Shahriyar Dipto
Fahim Shahriyar Dipto

Fahim Shahriyar Dipto is a graduate of Mechanical Engineering at BUET. With over 1.5 years of experience at Exceldemy, he authored 70+ articles on ExcelDemy. He has expertise in designing worksheets at You’ve Got This Math. Currently, He is a Team Leader at Brainor. Dipto's passion extends to exploring various aspects of Excel. Beyond tech, he enjoys creating engaging kids' worksheets using Illustrator. A dedicated employee and innovative content developer, He incorporates a commitment to academic excellence and... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo