How to Conditional Format for Dates Within 30 Days in Excel (3 Methods)

The below dataset has 3 columns displaying Order ID, Date, and Amount.

Method 1 – Conditional Formatting for Dates within 30 Days for Dates in a Range

Steps:

  • Click: Home > Conditional Formatting > Highlight Cells Rules > Between

A dialog box will open up.

Using Between Option in Excel

  • Set a date range between 30 days. I have set 30-11-21 to 31-12-21.
  • Press OK.

Now we have got our desired dates with highlighted colors.

Read more: Excel Conditional Formatting Based on Date


Method 2 – Conditional Formatting for Dates within 30 Days for a Specific Date

Steps:

  • Click: Home > Conditional Formatting > Highlight Cells Rules > A Date Occurring.

A dialog box will appear.

Using A Date Occurring Option in Excel

  • Select your desired month from the date selection bar.
  • Press OK.

Using A Date Occurring Option in Excel

Here’s the output for Last month.

Using A Date Occurring Option in ExcelAnd the output for This month.

Using A Date Occurring Option in Excel

And the output for Next month.

Read more: Apply Conditional Formatting to Overdue Dates in Excel


Case 3 – Combine AND and TODAY Functions with Conditional Formatting for Dates within 30 Days 

Steps:

  • Click: Home > Conditional Formatting > New Rule.

A dialog box named “Edit Formatting Rule” will open up.

AND and TODAY Functions for Conditional Formatting Dates Within 30 Days

  • Select Use a formula to determine which cells to format from Select a Rule Type bar.
  • Enter the following formula in the Edit the Rule Description bar:
=AND(C5>=TODAY(), C5<=(TODAY()+30))
  • Click Format.

Format Cells dialog box will appear.

AND and TODAY Functions for Conditional Formatting Dates Within 30 Days

  • Choose your desired color from the Fill option. I have chosen light green.
  • Press OK, and we’ll go back to the previous dialog box.

AND and TODAY Functions for Conditional Formatting Dates Within 30 Days

  • Press OK.

AND and TODAY Functions for Conditional Formatting Dates Within 30 Days

Now you will observe that the dates from today to the next 30 days are highlighted with our chosen light green color.

  • For dates from today to the previous 30 days, enter the following formula:
=AND(C5<=TODAY(), C5>=(TODAY()-30))

How the formula works:

C5>=TODAY()

Here, the TODAY function will check if the date in Cell C5 is greater than today’s date or not. So it returns:

FALSE

C5<=(TODAY()+30)

It will check if the date is less than or equal to today’s date + 30 days and returns:

TRUE

AND(C5<=TODAY(), C5>=(TODAY()-30))

The AND function encapsulates these two conditions. When both are true, the date is highlighted; otherwise, it is not highlighted.


Download the Practice Book

You can download the free Excel template from here and practice.


Related Articles

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

Get FREE Advanced Excel Exercises with Solutions!
Md. Sourov Hossain Mithun
Md. Sourov Hossain Mithun

Md. Sourov Hossain Mithun, an Excel and VBA Content Developer at Softeko's ExcelDemy project, joined in October 2021. Holding a Naval Architecture & Marine Engineering degree from BUET, Mithun showcases expertise during his two-year tenure. With over 200 published articles on Excel topics, he earned a promotion to Team Leader, excelling in leading diverse teams. Mithun's passion extends to Advanced Excel, Excel VBA, Data Analysis, and Python programming, contributing significantly to the innovative and dynamic environment of ExcelDemy... Read Full Bio

2 Comments
  1. Case #3 was exactly what I needed!! Thanks.

    Instead of breaking it into two separate arguments, I was doing a range (i.e. – TODAY()<=C5<=(TODAY()-30)). Excel accepted it as a range, but it ultimately doesn't work (and was quite frustrating to figure out Excel was the problem and not the formula).

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo