How to Change Cell Color Based on Date Using Excel Formula

We will use the following sample data set to demonstrate how to change the color of a cell based on the date.

4 Easy Ways to Change Cell Color Based on Date Using Excel Formula


Method 1 – Change the Cell Color of Dates Based on Another Value

Case 1.1 – Greater Than Particular Date

Steps:

  • Select the cell range C5:C13 and go to the Home tab of the ribbon.
  • Under the Styles group, select Conditional Formatting.

  • Select Highlight Cells Rules and choose Greater Than.

Change Cell Color of Dates Greater Than Particular Date as An Easy Way to Change Cell Color Based on Date Using Excel Formula

  • Enter the specific date with which you want to compare and choose the highlighting style.
  • Press OK.

  • The cells containing dates greater than the date in the Conditional Formatting Rule will change their colors.

Case 1.2 – Less Than Particular Date

Steps:

  • Go to Conditional Formatting after choosing the cell range for highlighting.
  • From the Highlight Cells Rules drop-down, select Less Than.

Change Cell Color of Dates Less Than Particular Date as An Easy Way to Change Cell Color Based on Date Using Excel Formula

  • Insert the date in the Less Than dialog box for comparison and specify the cell style after highlighting.
  • Press OK.

  • Here’s the result for our sample and the date September 12, 2022.

Read More: Highlighting Row with Conditional Formatting Based on Date in Excel


Method 2 – Change Cell Color of Dates Between Two Particular Dates

We want to change the colors of cells that contain dates between 10 September and 25 September 2022 to yellow.

Steps:

  • Select the cell range C5:C17.

  • Select Conditional Formatting from the Home tab of the ribbon.
  • From the Highlight Cells Rules drop-down, select Between.

Change Cell Color of Dates Between Two Particular Dates as An Easy Way to Change Cell Color Based on Date Using Excel Formula

  • In the Format cells that are BETWEEN option, insert the starting and ending date.
  • Click the drop-down menu with and select the format you like.
  • Click OK.

  • Here’s the result for our sample.

Read More: Excel Conditional Formatting Based on Date


Method 3 – Change the Cell Color of Dates with a Particular Day

We want to change the cell colors that contain dates that fall on a Sunday.

Steps:

  • Select the cell range and go to the Home tab of the ribbon.
  • From the drop-down, select New Rule.

  • Under the Select a Rule Type menu, click on the last option: Use a formula to determine which cells to format.
  • In the Format values where this formula is true box, insert the following formula:
 =WEEKDAY(B4:B12)=1
  • Press Format to select the cell color and font style.

Change Cell Color of Dates with Particular Day as An Easy Way to Change Cell Color Based on Date Using Excel Formula

  • After setting all the criteria, press OK in the dialog box.

  • The dates that represents Sunday will be highlighted.

Note:

  • If you want to identify any other day than Sunday, use the equivalent number of that day in the Formula Bar in the New Formatting Rule Box. For WEEKDAY, Sunday is Day 1, Monday is 2, and so on until Saturday with a value of 6.

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


Method 4 – Change the Cell Color of Dates Within a Specific Period Before Today

Steps:

  • Select the dates from cell range C5:C17 and go to the Home tab of the ribbon.
  • Select the Conditional Formatting option under the Styles section.
  • Select Highlight Cell Rules.
  • Choose the A Date Occurring option.

Change Cell Color of Dates Within Some Specific Days as An Easy Way to Change Cell Color Based on Date Using Excel Formula

  • You will see the A Date Occurring dialog box.
  • Click on the left drop-down menu and you will get multiple options.

  • Select an option. We want all the days within the last month to be highlighted, so we chose the Last month option.
  • Specify the style criteria and press OK.

  • Here’s our result.

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


Download the Practice Workbook


Related Articles

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

Get FREE Advanced Excel Exercises with Solutions!
Rifat Hassan
Rifat Hassan

Rifat Hassan, BSc, Electrical and Electronic Engineering, Bangladesh University of Engineering and Technology, has worked with the ExcelDemy project for almost 2 years. Within these 2 years, he has written over 250 articles. He has also conducted a few Boot Camp sessions on effective coding, especially Visual Basic for Applications (VBA). Currently, he is working as a Software Developer to develop and deploy additional add-ins to enhance the customers with a more sophisticated experience with Microsoft Office Suits,... Read Full Bio

4 Comments
  1. Hi,
    I found this really useful but when I try to change a cell according to the DAY of the week the weekday function is returning more than one day. Eg, 1 is returning changes for Thu and Sun. Do you know why this is?
    Thanks for your help!!

    • Hi Jennifer,
      I think you have issues with your dates. Make sure your dates are accurate and in proper date format. Confirming your dates, you can apply the WEEKDAY function again. Still, if you suffer from this problem, it’s better to check the format that you’ve applied. To highlight Sunday you will apply the following formula: =WEEKDAY(B4:B12)=1. Make sure that the range inside the WEEKDAY function is legit. If everything goes just fine, this formula will highlight all the Sundays throughout your dates.
      If nothing works for you, I would suggest you send your Excel file to my mail address: [email protected]. I will see what’s wrong with your data.
      Thanks!

  2. nice delivery

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo