Help with IF

  • Thread starter Thread starter mmm1106
  • Start date Start date
M

mmm1106

can anyone tell me why this formula works
=IF(AND(G7<(TODAY()-15),I7=TRUE),"OK","contract required")

but this one doesn't

=IF(AND(G7<(TODAY()-15),I7=yes),"OK","contract required")

it's driving me mad...

thanks!

Mel x
 
mmm1106 said:
can anyone tell me why this formula works
=IF(AND(G7<(TODAY()-15),I7=TRUE),"OK","contract required")

but this one doesn't

=IF(AND(G7<(TODAY()-15),I7=yes),"OK","contract required")

it's driving me mad...

Because unless you have defined yes as a name, Excel doesn't recognise it.
If you want to look for yes as a text string, you need to put it in double
quotes, just as you've done with the strings "OK" and "contract required".
By contrast, TRUE is a logical value which Excel recognises.
 
Maybe the 2nd formula should read as:
=IF(AND(G7<(TODAY()-15),I7="yes"),"OK","contract required")

i.e. I7="yes" instead of just: I7=yes
(Without the double quotes, yes would be interp'd as a defined name)
 
Back
Top