Excel: Color Cells Automatically by Date
In this article
This guide shows you how to make Excel cells change color automatically based on a date, using conditional formatting. You'll learn to highlight upcoming deadlines, overdue tasks, birthdays, or any date-based rule you need. No formulas or VBA required—just a few clicks.
What You'll Need
- Microsoft Excel (2010 or later, including Microsoft 365)
- A column or range of cells containing dates (or text that Excel recognizes as dates)
- Basic familiarity with selecting cells and opening menus
Step-by-Step
- Select the cells that contain your dates. For example, click on the letter at the top of column A to select the entire column, or drag to select a specific range like A2:A20.
- On the Home tab, in the Styles group, click Conditional Formatting.
- Choose New Rule from the dropdown menu.
- In the New Formatting Rule dialog, select Use a formula to determine which cells to format (this gives you the most flexibility).
- In the formula box, enter a formula that returns TRUE for the dates you want to highlight. For example, to highlight dates that are today or earlier (overdue), use:
=A2<=TODAY()(adjust A2 to the first cell in your selection). - Click the Format… button, go to the Fill tab, choose a color (e.g., red), and click OK.
- Click OK again to apply the rule. Your cells now change color based on the date.
- To add more rules (e.g., highlight dates within the next 7 days in yellow), repeat steps 2-7 with a different formula like
=AND(A2>TODAY(), A2<=TODAY()+7)and a different fill color.
Common Mistakes
- Using absolute references like
$A$2in the formula—this will apply the rule only to the first cell, not the whole range. Use relative references (no dollar signs) for the first cell. - Entering dates as text—if your cells contain text like "Jan 5" instead of a real date, Excel may not recognize them. Ensure they are actual date values (right-align by default).
- Applying the rule to the wrong range—if you select the entire column but your data starts at row 2, the formula should reference row 2, not row 1.
- Forgetting to set a fill color—if you don't choose a format, the rule will do nothing visible.
Tips
- Use Manage Rules (under Conditional Formatting) to edit, delete, or reorder your rules. Rules are applied in order, and the first matching rule wins (unless "Stop If True" is checked).
- For a quick preset, try Highlight Cells Rules > A Date Occurring—it offers options like "Yesterday", "Today", "Next month", etc., without formulas.
- Combine multiple conditions with
ANDorORin your formula. For example, to highlight weekends:=WEEKDAY(A2,2)>5. - Use the Format Painter to copy your conditional formatting to other ranges.
- If your dates are in a table (Insert > Table), use structured references like
[@Date]for more readable formulas.
Troubleshooting
- Nothing happens when I apply the rule. Check that your formula returns TRUE for at least one cell. Temporarily type the formula in a blank column to see what it returns. Also verify that the range is correct and that the cells contain real dates (try changing the number format to see if it shows a serial number).
- The rule highlights the wrong cells. Make sure your formula uses relative references for the first cell in the selection. If you selected A2:A20, the formula should be
=A2<=TODAY(), not=A$2<=TODAY(). - The color doesn't update when the date changes. Excel recalculates TODAY() when the workbook is opened or when a change is made. Press F9 to force a recalculation if needed.
- I see a green triangle or a number instead of a date. Your cells are likely formatted as text or general. Select the cells, press Ctrl+1, and choose a date format. You can also use Text to Columns (Data tab) to convert text to dates.
- Multiple rules conflict. Go to Conditional Formatting > Manage Rules, and reorder them so the most specific rule is first. Check the "Stop If True" box to prevent lower rules from overriding.
Frequently Asked Questions
Can I highlight cells based on a date in another cell?
Yes. Use a formula that references that cell, e.g., =A2>$B$1 to highlight dates after the date in B1. Remember to use absolute reference for the comparison cell.
How do I highlight an entire row based on a date?
Select the entire data range (e.g., A2:D20), then use a formula that references the first row's date cell, like =$A2<=TODAY(). The dollar sign before the column letter locks the column, allowing the row to change.
Can I use conditional formatting to color cells that are blank or contain no date?
Yes, use =ISBLANK(A2) or =A2="" to format empty cells. Combine with NOT to format non-blank cells.
Will this work in Google Sheets?
Yes, the steps are similar. In Google Sheets, go to Format > Conditional formatting, and use custom formulas like =A2<=TODAY().
How do I remove conditional formatting?
Select the cells, go to Conditional Formatting > Clear Rules > Clear Rules from Selected Cells. To remove all rules from the sheet, choose "Clear Rules from Entire Sheet".
Can I use a color scale instead of a solid fill?
Yes. Under Conditional Formatting, choose Color Scales to apply a gradient based on date values. For example, a 3-color scale can show early dates in green and later dates in red.