IF formula misbehaving with determining year of an event

  • Thread starter Thread starter Pierre
  • Start date Start date
P

Pierre

In D14 I enter 04/23/2008
in D15 the formula contains
=IF(RIGHT(D14,2)="08","true_value","false_value")

Why is D15 returning "false_value"?
I'd expect "true_value"

Thanks for your help.
Pierre
 
Because you are trying to use the RIGHT function (which is designed to
manipulate a string) with a value; in Excel 4/23/08 is equal to 39561
because it is counting the number of days since 1/1/1900.

Try using YEAR instead of RIGHT:
=IF(YEAR(D14)=2008,true,false)
 
You could try:
=IF(TEXT(A5,"yy")="08","true_value","false_value")

HTH,
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top