Solved

# Excel Conditional formatting looking for date - 30 days change cell color

Posted on 2016-09-16
90 Views
Hi Experts,
I need a conditional format that will change a cell to yellow if the date is 30 or 60 or 90 days before today's date.,

Example, I have a column of expiry dates, (actually multiple columns but I will just copy to others later), I need to change cell color to when date is about to expire.

If cell's date is expiring 30 days from today or already expired then turn cell yellow.
That's it.
Thanks

If I could use a cell to dictate the 30 - 60 - 90 in the formula that would be awesome.
Thanks
Chris
0
Question by:chris pike

LVL 31

Expert Comment

ID: 41801765
Can you be more precise?  When you say "the date is 30 or 60 or 90 days before today's date", do you mean exactly 30, or 60, or 90 days, or (say) 30 - 59, 60 - 89, or 90+ days?  Do you want different colors for each date or date range?  Later  you say just yellow for expiring 30 days from today.
0

LVL 17

Assisted Solution

Roy_Cox earned 125 total points
ID: 41801852
Hi Chris

Select the cell and select Conditional Formatting in the Ribbon

Then Manage Rules and New Rule

When the New Formatting Rule window appears, select Format only cells that contain as the rule type.
You can apply multiple formulas as required and formats.

Enter the formula and choose the Format

The next step is to enter the range for the format to apply to

Remember that using a Table for the data then the range becomes dynamic and the Conditional Formatting expand as data is added or contract as data is removed.

Let me know if anything is not clear.
0

Author Comment

ID: 41801963
Hi Roy, Again.... :)
I changed it a little bit, I did Less than and then +30 days, it highlights anything almost expired or already expired.

How do i ignore blank cells, as above instructions highlights the blank cells, or do I need a second conditional format?
Thanks
0

LVL 27

Accepted Solution

Glenn Ray earned 250 total points
ID: 41802347
You can use a formula instead of a value comparison (as in above examples) to check for blank cells and ignore conditional formatting.

I've expanded on your question by creating an example workbook that applies three levels of conditional formatting:
Red: if Expiry Date is 90+ days old
Orange: if Expiry Date is 60+ days old
Yellow: if Expiry Date is less than or equal to 30 days from today's date

The rule are applied in the order stated above; if the first condition is true, the conditional formatting stops there, otherwise, it continues down the list.

The rules are:
Red:  =IF(AND(A2<>"",A2<=TODAY()-90),TRUE,FALSE)
Orange: =IF(AND(A2<>"",A2<=TODAY()-60),TRUE,FALSE)
Yellow: =IF(AND(A2<>"",A2<=TODAY()+30),TRUE,FALSE)

Note that the formulas use relative referencing (A2, not \$A\$2) so that you can just expand the range to which is applies and still have the formatting work.

My example also has an aging column to the right as a check to ensure that the proper formatting applies.

Regards,
-Glenn
EE-CondFormat.xlsx
0

LVL 17

Expert Comment

ID: 41802721
My Method still works, just add the other rules

0

LVL 31

Assisted Solution

Rob Henson earned 125 total points
ID: 41804422
@Roy - using your method doesn't allow for blanks

@Glenn - don't need the IF statement, the Conditional Formatting is checking for a TRUE statement to apply the format, formula can be just:

=AND(A2<>"",A2>TODAY()+30)

Thanks
Rob
0

Author Closing Comment

ID: 41812609
Thanks Everyone.
Got it done.
Good work.
0

LVL 17

Expert Comment

ID: 41812669
Hi Chris

0

## Featured Post

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…