Forum Discussion
Conditional formatting with a complex formula
I am trying to compare two dates and then highlight the cell based on how close the two dates are. See the example below:
| # of days | 20 |
| Date | 22-Oct |
| 10/16/2017 | |
| 10/1/2017 | |
| 11/5/2017 |
I've named the cell with "20" in it "NbrOfDays" and the cell with "22-Oct" in it as Due_Date. Here's the formula I've created for making the cell green:
=Due_Date-$A$4>(NbrOfDays*.67)
Here's the formula for making the cell yellow:
=(NbrOfDays*.67)>Due_Date-$A$4>(NbrOfDays*0.33)
Here's the formula for making the cell red:
=(NbrOfDays*0.33)>Due_Date-$A$4
It works for the cell with "10/16" in it, but I can't figure out how to get it to work for the rest of the cells without recreating it for each cell. When I change the range that the conditional formatting applies to, the entire selection changes based on what is in the first cell rather than what is in each individual cell. I'd really appreciate any help you can give me. Thank you!
1 Reply
- Haytham AmairahSilver Contributor
Hi Mary,
Try to replace $A$4 with $A4
Make sure to apply conditional formatting to the range, not just single cell.