How do I use an "IF" formula using dates in excell?

M

Mike

How do I use an "IF" function involving dates. For Example: (IF (a date in
one cell ends in 2005 THEN "x"),IF( a date in one cell ends in 2006 THEN
"Y"), " ")
 
B

bpeltzer

Assuming these cells are really dates and by 'ends in' you mean 'is in the
year', then you would do something like
=if(year(a1)=2005,true_value,false_value). If they're really strings that
end in 2005, then =if(right(a1,4)="2005",true_value,false_value)
 
M

Mike

Thank You so much I have been trying to figure out that formula on and off
for weeks. Do You work for Microsoft or do you just provide free advice
to people?
 
M

Mike

If you have the time I have a a really complicated and Puzzling Excell
question that also involves the "IF" formula between two worksheets. Do you
have an e-mail you would be willing to communicate over or do you perfer the
Microsoft "Chat room"?
 
W

Woodloch

Maybe you can help. Saw this and this is my question.

I have a date say 1/1/2005 in say cell J7; I want to write an if formula
that says if J7 is less than 7/1/2006 then it returns "expired" and if not it
returns "current"

Thanks
 
W

Woodloch

That works! Thanks so much but could you tell me why you couldn't simply say
=if (J7 < 7/1/2006, "expired", "current")
 
D

Dave Peterson

7/1/2006 = 7 divided by 1 divided by 2006 (=0.00349). It's not a date.

By using date(2006,7,1) or having excel coerce the text "7/1/2006" (with +0) to
a date, the formula could evaluate the way you want.
 
Top