ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Conditional formatting and formula (https://www.excelbanter.com/excel-worksheet-functions/89629-conditional-formatting-formula.html)

jonas.ornborg

Conditional formatting and formula
 

Hi, I am trying to write a formula within the conditional formatting
dialog box. I have a column with dates and I wont the cell to become
red whenever the date in the cell is more then 3 years older then
todays date. Does anyone have an idea of how to write this formula?

I have tried this formula but it doesnt seem to work

=DATEDIF(J3;TODAY();"y"3)

All the best
Jonas


--
jonas.ornborg
------------------------------------------------------------------------
jonas.ornborg's Profile: http://www.excelforum.com/member.php...o&userid=32183
View this thread: http://www.excelforum.com/showthread...hreadid=543837


Mark Lincoln

Conditional formatting and formula
 
This way should work:

=DATEDIF(J3;TODAY();"y")2

First of all, you had the "3" test within the DATEDIF function.
Secondly, DATEDIF will return only the whole number of years between
the two dates. So if the formula equals 3, there are at least 3 years
between the dates. That's why you want to test for 2.


jonas.ornborg

Conditional formatting and formula
 

Thanks!
It worked perfect! I guessed I had written the formula wrong but
couldnt find out what.

Again, many thanks!

All the best Jonas:)


--
jonas.ornborg
------------------------------------------------------------------------
jonas.ornborg's Profile: http://www.excelforum.com/member.php...o&userid=32183
View this thread: http://www.excelforum.com/showthread...hreadid=543837


Mark Lincoln

Conditional formatting and formula
 
Glad to help. Thanks for the feedback.



All times are GMT +1. The time now is 04:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com