We can highlight cells with dates earlier than the current date or within a date range earlier than the current date using conditional formatting in Excel. Using conditional formatting, you can highlight specific cells in a worksheet by giving them a color based on guidelines or conditions. Therefore, this article will demonstrate 4 ways of conditional formatting based on the date range.
π Download Excel File
Download the Excel file used for the demonstration from the link below.
Learn to Apply Conditional Formatting Based on Date Range in Excel with These 4 Methods
First, let us get familiarized with the dataset used as an example throughout the article. We have a dataset of project records that includes five projectsβ starting and ending dates and their deadlines. Using Conditional Formatting, we want to identify which projectβs deadline has already passed. Accordingly, we will show you 4 ways of conditional formatting based on the date range in Excel.
1. Using Basic Conditional Formatting Feature
In this method, we will highlight the dates that fall between the start and end dates. For this, we used the Between from the basic drop-down options here. Let us have a look at the steps.
β¬οΈβ¬οΈ STEPS β¬οΈβ¬οΈ
- First, select the range C6:C10. Then, go to Conditional Formatting of the Home tab in the Ribbon, and select Between from the Highlight Cell Rules.
- Next, a Between named box will pop up. Insert $C$12 and $C$13 for indicating the values to highlight and choose formatting according to your choice from Custom Format and click on OK.
- Now, we will have the dates in between the range highlighted.
π Read More: 4 Ways to Use Conditional Formatting for Dates Overdue in Excel
2. Basic Formula Approach
In this second method, we employed a simple formula to apply as a condition to format the deadline that has passed. So, let us see the steps to apply this function.
β¬οΈβ¬οΈ STEPS β¬οΈβ¬οΈ
- First, select the range C6:C10. Then, select New Rule from the Conditional Formatting of the Home tab in the Ribbon.
- Next, New Formatting Rule named box will pop up. Select βUse a formula to determine which cells to formatβ as the rule type and enter the formula in βFormat values where this formula is trueβ. Choose the format according to your desire and press OK.
=(C6<=$C$13)*(C6>=$C$12)
π Read More: How to Apply Excel Formula to Change Text Color Based on Value
3. Applying AND & TODAY Functions
We will apply AND and TODAY functions as a condition for formatting based on the date range. The AND function determines if all conditions are TRUE in the test. On the other hand, the TODAY function returns the current dateβs serial number and Excel calculates the date and time using the serial number as the date-time code. Let us see the steps now.
β¬οΈβ¬οΈ STEPS β¬οΈβ¬οΈ
- First, select the range C6:C10. Then, select New Rule from the Conditional Formatting of the Home tab in the Ribbon.
- Next, New Formatting Rule named box will pop up. Select βUse a formula to determine which cells to formatβ as the rule type and enter the formula in βFormat values where this formula is trueβ. Choose the format according to your desire and press OK.
=AND($C6<=TODAY(), TODAY()-$C6<=25)
π¨ Formula Breakdown
Here, the formula we inserted is:
AND($C6<=TODAY(), TODAY()-$C6<=25)
π
Here, the TODAY function returns the date code of the day in which the calculation is done.
π
Then, $C6<=TODAY() is the first condition which checks that if the date in cell C6 is less than or equal to todayβs date, and TODAY()-$C6<=25 is the second condition which checks if the deadline falls into last 25 days from today.
π
Lastly, AND function returns TRUE if both condition are met.
4. Using OR & TODAY Functions
This method will apply OR and TODAY functions as a condition for formatting based on the date range. The OR function determines if any condition is TRUE in the test. On the other hand, the TODAY function returns the current dateβs serial number and Excel calculates the date and time using the serial number as the date-time code. Let us see the steps now.
β¬οΈβ¬οΈ STEPS β¬οΈβ¬οΈ
- First, select the range C6:C10. Then, select New Rule from the Conditional Formatting of the Home tab in the Ribbon.
- Next, New Formatting Rule named box will pop up. Select βUse a formula to determine which cells to formatβ as the rule type and enter the formula in βFormat values where this formula is trueβ. Choose the format according to your desire and press OK.
=OR($C6<=TODAY(), TODAY()-$C6>=25)
π¨ Formula Breakdown
Here, the formula we inserted is:
OR($C6<=TODAY(), TODAY()-$C6>=25)
π
Here, the TODAY function returns the date code of the day in which the calculation is done.
π
Then, $C6<=TODAY() is the first condition which checks that if the date in cell C6 is less than or equal to todayβs date and TODAY()-$C6<=25 is the second condition which checks if the deadline falls into last 25 days from today.
π
Lastly, OR function returns TRUE if any of the conditions is met.
- Lastly, the outcome looks like this.
π Important Notes
ποΈ
TODAY function returns the serial number of the current date which is the date-time code used by Excel for calculations.
ποΈ
Β After entering the function, Excel changes the cell format to Date from General. To see the serial number of dates, you must change the cell format to General or Number.
π Takeaways from This Article
π
Β This article demonstrated 4 methods of conditional formatting based on date range.
π
Β In the first method, we used HIGHLIGHT to format conditionally based on date range in Excel.
π
Β Then, we employed a simple formula for conditional formatting based on date range.
π
Β After that, we used AND & TODAY functions to format conditionally based on date range.
π
Β Finally, we employed OR & TODAY functions for conditional formatting based on date range in Excel.
Conclusion
This article has demonstrated 4 methods of conditional formatting based on date range in Excel. All these formulas are incredibly effective and simple to use. We hope this article helps you. Please leave a remark if you have any queries. The author will do their best to find an appropriate answer.
For more guides like this, visit Excelden.com.
Related Articles
- 5 Easy Ways to Highlight Highest Value in Excel
- Excel VBA: If Font Color Is Red Then Return Specific Output
- 6 Easy Ways to Highlight Lowest Value in Excel