In this article, we will show 4 ideal examples of how to use if statement between two numbers in Excel. To check if a number is within 2 boundary ranges, we can use the IF and AND functions. You can easily do this task in Excel. So, without any delay, let’s start the discussion.
4 Ideal Examples of IF Statement Between Two Numbers in Excel
To demonstrate the methods, we will use the following dataset. The dataset contains information on the employees of a company. Here, there is information about Employee’s Name, Age and Joining Dates. Now, we will show 4 ideal examples of Excel IF statement between two numbers.
1. Use IF Statement Between Two Numbers in Excel
In this example, with the AND Function, we can find out if the age of the employees is inside 2 boundary numbers. And with the IF Function, we can add writing to the conditions. Let’s follow the steps below to learn the method.
1.1. Use IF Statement Between Two Numbers Exclusively
- Firstly, declare the boundary numbers.
- Here, we have taken 32 and 26 as Upper Limit and Lower Limit respectively.
- So, we will find out if the age is between this boundary condition.
- To do so, write the following formula in the formula bar of the D5 cell:
=IF(AND(C5>$C$16,C5<$C$15),"Yes","No")
- Then, press Enter to see the result.
- Here, this No result indicates that the value is not between the limits.
- After that, drag down the formula in the D6:D13 range with the Fill Handle option.
- As a result, you can observe the result in the DÂ column.
- Here, if the age is between 26 and 32 exclusively, then it is showing Yes.
- Else, the result is showing No.
Read More: How to Use IF Statement with Yes or No in Excel
1.2. Use IF Statement Between Two Numbers Inclusively
- In the following step, we will find out if the age is between this boundary condition with the Inclusive condition.
- Now, write down the following formula in the formula bar of the E5 cell:
=IF(AND(C5>=$C$16,C5<=$C$15),"Yes","No")
- Then, press Enter to see the result.
- Here, this Yes indicates that the value is between the limits.
- After that, drag down the formula in the E6:E13 range with the Fill Handle option.
- As a result, you can observe the result in the EÂ column.
- Here, if the age is between 26 and 32 inclusively, then it is showing Yes.
- Else, the result is showing No.
Read More: How to Use IF Function with OR and AND Statement in Excel
2. Check If Value Is Between Maximum and Minimum Numbers
In this example, we will find out if the age of the employees is inside 2 boundary numbers. Let’s follow the steps below to learn the method.
2.1. Consider Exclusive Result
- Firstly, declare the boundary numbers.
- Here, we have taken 35,38, and 34 as Upper Limits.
- And, we have taken 28,27, and 26 as Lower Limits.
- From these limits, we have to calculate the Upper Limit and Lower Limit respectively.
- After that, we will find out if the age is between the calculated boundary condition.
- To do so, write the following formula in the formula bar of the D5 cell:
=IF(AND(C5>MIN($C$16:$E$16),C5<MAX($C$15:$E$15)),"Yes","No")
- Then, press Enter to see the result.
- Here, this No result indicates that the value is not between the limits.
- After that, drag down the formula in the D6:D13 range with the Fill Handle option.
- As a result, you can observe the result in the DÂ column.
- Here, if the age is between the calculated upper and lower range exclusively, then it is showing Yes.
- Else, the result is showing No.
Read More: How to Use If Then Else Statement in Excel VBA
2.2. Find Inclusive Result
- In the following step, we will find out if the age is between this boundary condition with the Inclusive condition.
- Now, write down the following formula in the E5 cell:
=IF(AND(C5>=MIN($C$16:$E$16),C5<=MAX($C$15:$E$15)),"Yes","No")
- Then, press Enter to see the result.
- Here, this Yes result indicates that the value is between the limits.
- After that, drag down the formula in the E6:E13 range with the Fill Handle option.
- As a result, you can observe the result in the EÂ column.
- Here, if the age is between the calculated upper and lower range inclusively, then it is showing Yes.
- Else, the result is showing No.
Read More: Show Cell Only If Value Is Greater Than 0 in Excel
3. Insert IF Statement Between Two Dates in Excel
In this example, we will find out if the joining date of the employees is inside 2 boundary dates. Let’s follow the steps below to learn the method.
STEPS:
- Firstly, declare the boundary numbers.
- Here, we have taken the 1st of January, 2022 and 31st of December, 2022 as Lower Limit and Upper Limit respectively.
- So, we will find out if the joining date is between this boundary condition.
- To do so, write the following formula in the formula bar of the D5 cell:
=IF(AND(C5>=$C$16,C5<=$C$15),"Yes","No")
- Then, press Enter to see the result.
- After that, drag down the formula in the D6:D13 range with the Fill Handle option.
- As a result, you can observe the result in the DÂ column.
- Here, if the joining date is between 1st January and 31 December 2022 then it is showing Yes.
- Else, the result is showing No.
Read More: How to Use IF Statement with Not Equal To Operator in Excel
4. Apply IF Statement to Check If Dates Are Within Some Specific Days
In this example, we will find out if the joining date of the employees is within some specific days.
4.1. Within Next N Days
Suppose, we want to find out if there is any possibility of a new joining within a few days. Therefore, in the following step, we will find out if the joining date of the employees is within the next some days.
- Now, write down the following formula in the formula bar of the D5 cell:
=IF(AND(C5>TODAY(),C5<=TODAY()+7),"Upcoming Joining","Already Joined")
- Then, press Enter to see the result.
- Today is 11th January 2023.
- And, as the date is not between 11 to 18th January 2023, it is showing Already Joined.
- After that, drag down the formula in the D6:D13 range with the Fill Handle option.
- As a result, you can observe the result in the DÂ column.
- Here, if the joining date is between today and (today+7) days, then it is showing Upcoming Joining.
- Else, the result is showing Already Joined.
4.2. Within Last N Days
Suppose, we want to find out if there is any possibility of new joining within a few days. Therefore, in the following step, we will find out if the joining date of the employees is within the next some days.
- Now, write down the following formula in the formula bar of the D5 cell:
=IF(AND(C5>TODAY(),C5<=TODAY()+7),"Upcoming Joining","Already Joined")
- Then, press Enter to see the result.
- Today is 11th January 2023.
- And, as the date is not between 11 to 4th January 2023, it is showing No.
- After that, drag down the formula in the D6:D13 range with the Fill Handle option.
- As a result, you can observe the result in the DÂ column.
- Here, if the joining date is between today and (today–7) days, then it is showing Recently Joined.
- Else, the result is showing No.
Download Practice Workbook
To practice by yourself, download the following workbook.
Conclusion
In this article, we have demonstrated 4 examples of Excel IF statement between two numbers. There is a practice workbook at the beginning of the article. Go ahead and give it a try. Last but not least, please use the comment section below to post any questions or make any suggestions you might have.