Highlighting Row with Conditional Formatting Based on Date in Excel

Here’s the overview of the functions we’ll use today and how they highlight cells or rows based on dates or ranges.

The Overview Image of Excel Conditional Formatting Highlight Row Based on Date

We have a data table with the Sales value, Order Date, and Delivery Date for different items. The date format is dd/mm/yyyy.

The Dataset of Excel Conditional Formatting Highlight Row Based on Date

Method 1 – Using Highlight Cells Rules Option to Conditionally Format Rows Based on Date in Excel

We’ll highlight cells with dates in the previous month.

Date Set of Using Highlight Cells Rules Option to Highlight Cell Based on Date

Steps:

  • Select the data range on which you want to apply the Conditional Formatting. We selected C5:C11.

Selecting cell C5:C11 from the Dataset

  • Go to the Home tab.
  • Click on the Conditional Formatting dropdown.
  • Choose Highlight Cells Rules and select the A Date Occurring option.

Clicking on Conditional Formatting Dropdown >> Highlight Cells Rules Groups >> A Date Occurring Option.

  • A Date Occurring Wizard will open.
  • Select the Last Month option from the dropdown on the left and use any formatting you like.

Selecting Last Month Option from the left-side box Dropdown and Light Red Fill Option from the right-side box Dropdown on A Date Occuring Doalogue box

  • The last month’s Order Dates will be highlighted as below.

Results After Using Highlight Cells Rules Option to Highlight Cell Based on Date

Read more: Excel Conditional Formatting Based on Date


Method 2 – Highlighting Specific Dates with Excel Conditional Formatting

Let’s say you want to highlight the rows that have a specific date. We’ll use the date constant as 25-11-2021.

Dataset of Highlighting Specific Dates with Conditional Formatting

Steps:

  • Select the data range on which you want to apply the Conditional Formatting.
  • Go to the Home tab and choose Conditional Formatting.
  • Select New Rule.

Selecting New Rule from Home tab >> Conditional Formatting

  • The New Formatting Rule Wizard will appear.
  • Select the Use a formula to determine which cells to format option.

Choosing Rule Type in New Formatting Rule Dialogue Box

  • Click on the Format button.

Clicking on Format Option in New formatting Rule Dialogue Box

  • Under Fill, select a background color.
  • Click on OK.

Choosing Fill Color in Format Cells

  • The Preview will be shown below.

Preview Option of New Formatting Rule Window

  • Use the following formula in the Format values where this formula is true: box.
=$C5=DATEVALUE("25/11/2021")

When the cells of Column C are Equal to the date 11/25/2021, then the Conditional Formatting will appear in those rows. The DATEVALUE function will convert the text date into a value.

  • Press OK.

Typing Formula in Formatting Rule Window for Conditional Formatting

  • You will get the rows with the specific date 25/11/2021 highlighted.

Results After Highlighting Specific Dates with Conditional Formatting

Read more: Conditional Formatting Based on Date in Another Cell in Excel


Method 3 – Using the TODAY Function to Highlight Dates by Excel Conditional Formatting

Suppose you want to highlight the dates before the past seven days in the Order Date column.

Dataset for Highlighting Dates by Using TODAY Function

Steps:

  • Open the New Formatting Rule dialogue box from the Conditional Formatting option on the Home tab ribbon.

New Formatting Rule Dialgoe Box

  • Use the following formula in the Format values where this formula is true: box.
=$C5<TODAY()-7
  • Press OK.

Putting Formula in New Formatting Rule dialogue box for Highlighting Dates by Using TODAY Function

  • You will get the rows highlighted.

Results after Highlighting Dates Using TODAY Function

Note: If you want to find values older than 1 year, your formula will be:

=$C5<TODAY()-365

Read more: Apply Conditional Formatting for Dates Older Than Today in Excel


Method 4 – Highlighting Rows Based on Date for Multiple Conditions Using the AND Function

Let’s to highlight the rows which have delivery dates before 05/12/2021 and the sales value greater than $5,000.

Dataset for Highlighting Row Based on Date for Multiple Conditions Using AND Function

Steps:

  • Open the New Formatting Rule dialogue box from the Conditional Formatting option on the Home tab ribbon.
  • You will get the following New Formatting Rule dialog box.

New Formatting Rule Dialgoe Box

  • Use the following formula in the Format values where this formula is true: box.
=AND($D5<DATE(2021,12,5),$E5>5000)
  • Press OK.

Inserting Formula on New Formatting Rule Window for Highlighting Row Based on Date for Multiple Conditions Using AND Function

  • This will highlight the applicable rows.

Results After Highlighting Row Based on Date for Multiple Conditions Using AND Function


Method 5 – Using the OR Function to Highlight Rows Based on Date for Multiple Conditions 

Let’s highlight the rows that have delivery dates before 05/12/2021 or a sales value greater than $5,000.

Steps:

  • Open the New Formatting Rule dialogue box from the Conditional Formatting option on the Home tab ribbon.

New Formatting Rule Dialgoe Box

  • Use the following formula in the Format values where this formula is true: box.
=OR($D5<DATE(2021,12,5),$E5>5000)
  • Press OK.

Inserting Formula on New Formatting Rule Window for Highlighting Row Based on Date for Multiple Conditions Using OR Function

  • Here are the results for our sample.

Results of Using OR Function to Highlight Row Based on Date for Multiple Conditions 


Method 6 – Applying Excel Conditional Formatting Based on Date for Multiple Conditions Using the IF Function

We have added a column named Helper. We want to highlight the rows which have delivery dates before 05/12/2021 and a sales value greater than $5,000.

Dataset for Applying Conditional Formatting Based on Date for Multiple Conditions Using IF Function

Steps:

  • Select the output Cell F5.
  • Use the following formula and press Enter.
=IF($D5<DATE(2021,12,5),IF($E5>5000,"Matched","Unmatched"),"Unmatched")
  • IF will return “Matched” if both the conditions are met.

Formula for determing Cells which Satisfy Condition

  • Drag down the Fill Handle tool.

Use of Fill Handle to Copy Formula

  • Open the New Formatting Rule dialog box.

New Formatting Rule Dialgoe Box

  • Use the following formula in the Format values where this formula is true: box.
=$F5="Matched"
  • Press OK.

Inserting Formula on New Formatting Rule Window

  • Here are the results.

Results After Applying Conditional Formatting to Row Based on Date for Multiple Conditions Using IF Function

Read more: Excel Conditional Formatting Formula with IF


Method 7 – Conditional Formatting Based on Gaps Between Dates

Suppose you want to highlight the rows with a difference between the Delivery Date and Order Date less than 6 days (for highlighting the fast delivery rows). We have added a column named Gap.

Dataset for Conditional Formatting Row Based on Gaps Between Dates

Steps:

  • Select the output Cell F5.
  • Use the following formula and press Enter.
=D5-C5
  • This will return the gaps between the two dates (Delivery Date and Order Date).

Inserting Formula for Determining Gap Between Order Date & Delivery Date

  • Drag down the Fill Handle tool.

Using Fill Handle to Copy Formula to Other Cells

  • Open the New Formatting Rule dialog box.

New Formatting Rule Dialgoe Box

  • Use the following formula in the Format values where this formula is true: box.
=$F5<6
  • Press OK.

Inserting Formula for Conditional Formatting Based on Gaps Between Dates

  • Here are the results.

Results After Conditional Formatting Row Based on Gaps Between Dates


Method 8 – Highlighting Rows Based on Empty Dates with Excel Conditional Formatting

Let’s highlight the rows where the Delivery Date is empty. We’ve removed a few dates from the dataset.

Dataset For Highlighting Rows Based on Empty Dates in Excel

Steps:

  • Open the New Formatting Rule dialog box.

New Formatting Rule Dialgoe Box

  • Use the following formula in the Format values where this formula is true: box.
=$D5=""
  • Press OK.

Inserting Formula in New Formatting Rule dialogue box

  • Here are the results.

Results of Highlighting Rows Based on Empty Dates in Excel

Read more: Conditional Formatting for Blank Cells in Excel


Method 9 – Applying Conditional Formatting to Rows Based on Non-Empty Dates

Steps:

  • Select cells B5:E11 and follow the steps of Method 2 to open the New Formatting Rule dialog box.

New Formatting Rule Dialgoe Box

  • Use the following formula in the Format values where this formula is true: box.
=$D5<>""
  • Press OK.

Inserting Formula on New Formatting Rule Window for Highlighting Row Based on Non-Empty Dates in Excel

  • Here are the results.

Results After Highlighting Row Based on Non-Empty Dates in Excel


Method 10 – Highlighting Weekends Using Excel Conditional Formatting and the WEEKDAY Function

Let’s highlight rows that have Saturdays and Sundays in the Delivery Date.

Dataset for Highlighting Row that Contain Weekends Using Conditional Formatting

Steps:

  • Select cells B5:E11 and follow the steps of Method 2 to open the New Formatting Rule dialog box.
  • Use the following formula in the Format values where this formula is true: box.
=WEEKDAY($D5,2)>5
Here, $D5 is the corresponding date value and 2 is for Numbers 1(Monday) through 7(Sunday). So, WEEKDAY will return 6 and 7 for Saturday and Sunday respectively.
When the values will be 6 and 7, then the Conditional Formatting will appear in the corresponding rows.
  • Press OK.

Inserting Formula on New Formatting Rule Window for Highlighting Row that Contain Weekends Using Conditional Formatting

  • You will get the rows highlighted for weekends.

Results After Highlighting Row that Contain Weekends Using Conditional Formatting


Method 11 – Applying Excel Conditional Formatting to Highlight Special Dates

We have created a new cell that will be used to hold the search value for the Order Date.

Dataset for Highlighting Row that Contain Special Dates Using Conditional Formatting

Steps:

  • Select cells B5:E11 and follow the steps of Method 2 to open the New Formatting Rule dialog box.
  • Use the following formula in the Format values where this formula is true: box.
=MATCH($G$5,$C5,0)
  • Press OK.

Inserting Formula on New Formatting Rule Window for Highlighting Special Dates Using Conditional Formatting

  • Here are the results.

Results After Highlighting Row Containing Special Dates Using Conditional Formatting


Download the Practice Workbook


Further Readings

<< Go Back to Conditional Formatting Based on Date | Conditional Formatting | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Tanjima Hossain
Tanjima Hossain

TANJIMA HOSSAIN is a marine engineer who enjoys working with Excel and VBA programming. For her, programming is a handy, time-saving tool for managing data, files, and online tasks. She's skilled in Rhino3D, Maxsurf C++, MS Office, AutoCAD, and Excel & VBA, going beyond the basics. She holds a B.Sc. in Naval Architecture & Marine Engineering from BUET and is now a content developer. In this role, she creates tech-focused content centred around Excel and VBA. Apart from... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo