Conditional Formatting - Overdue Expiry Date

hamistasty

Board Regular
Joined
May 17, 2011
Messages
208
I'm after a conditional format forumla that checks each value of a cell in a column and shows the word EXPIRED (and highlighted red) if the current date is past the date entered, and shows the word RENEW (and highlighted blue) if the current date is within 30 days of the date in the cell. Also the cell shows the input date and is highlighted green if the current date is before 30 days of the input date in the cell.

Thanks!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Conditional Formatting can't return a Value. It only can change the cells's format based on a condition.

In the example below, column B has IF formulas to return "Expired", "Renew", or "Current" based on the dates in column A.

The conditional Formatting changes the background colors to Red if Expired or Blue if within 30 days. The default background color is set as green.
Excel Workbook
AB
1May 18, 2011Expired
2June 18, 2011Expired
3July 22, 2011Renew
4August 19, 2011Current
Sheet
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A11. / Formula is =$A1Abc
A12. / Formula is =$A1-30Abc
B11. / Formula is =$A1Abc
B12. / Formula is =$A1-30Abc
A21. / Formula is =$A2Abc
A22. / Formula is =$A2-30Abc
B21. / Formula is =$A2Abc
B22. / Formula is =$A2-30Abc
A31. / Formula is =$A3Abc
A32. / Formula is =$A3-30Abc
B31. / Formula is =$A3Abc
B32. / Formula is =$A3-30Abc
A41. / Formula is =$A4Abc
A42. / Formula is =$A4-30Abc
B41. / Formula is =$A4Abc
B42. / Formula is =$A4-30Abc
 
Upvote 0
Thanks. How would I add IF(A1="N/A","N/A")
edit: it's not letting me post the code blah
 
Last edited:
Upvote 0
Conditional Formatting can't return a Value. It only can change the cells's format based on a condition.

In the example below, column B has IF formulas to return "Expired", "Renew", or "Current" based on the dates in column A.

The conditional Formatting changes the background colors to Red if Expired or Blue if within 30 days. The default background color is set as green.
Excel Workbook
AB
1May 18, 2011Expired
2June 18, 2011Expired
3July 22, 2011Renew
4August 19, 2011Current
Sheet
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A11. / Formula is =$A1Abc
A12. / Formula is =$A1-30Abc
B11. / Formula is =$A1Abc
B12. / Formula is =$A1-30Abc
A21. / Formula is =$A2Abc
A22. / Formula is =$A2-30Abc
B21. / Formula is =$A2Abc
B22. / Formula is =$A2-30Abc
A31. / Formula is =$A3Abc
A32. / Formula is =$A3-30Abc
B31. / Formula is =$A3Abc
B32. / Formula is =$A3-30Abc
A41. / Formula is =$A4Abc
A42. / Formula is =$A4-30Abc
B41. / Formula is =$A4Abc
B42. / Formula is =$A4-30Abc

Thanks Alfafrog, you just sorted out my problem which was a variation on this theme.

I wondered why I couldn't get an IF statement to do what I expected in a conditional format. I hadn't realised conditional formats uses a different syntax to the spreadsheet formula. I've been struggling with this one for most of the day!
 
Upvote 0
I'm glad you were able to solve your problem.

I hadn't realised conditional formats uses a different syntax to the spreadsheet formula.

Just to clarify a bit, it's not so much a syntax difference. Conditional Format is expecting a formula result of either TRUE or FALSE. So in the case above...
=$A1 < TODAY()
..will return TRUE or FALSE. You could use this formula in a cell and get the same TRUE or FALSE result.
 
Upvote 0

Forum statistics

Threads
1,223,713
Messages
6,174,043
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top