Home > Software engineering >  Avoiding formatting in blank cells
Avoiding formatting in blank cells

Time:08-01

this is my first post and a newb at Excel.

I did a few date formulas with conditional formatting and realised after that the formatting is being applied to all the blanks cells as well.

Is there an easy edit I can add to the existing formulas i wrote or do I have to start again?

Formulas below :

=AND($D2>TODAY(),$D2-TODAY()<=7)

=$D2<TODAY()

=$D2=TODAY()

CodePudding user response:

Use IF() function to detect either it empty or not. Then apply formula if it is not empty. By default excel empty/blank cell is determine as 0 zero when you are comparing with number values. Dates are nothing but number value. So, to avoiding blank cells in conditional formatting use IF() function like-

=IF($D2<>"",AND($D2>TODAY(),$D2-TODAY()<=7),FALSE)
  • Related