'12/25/2003 does not equal (12/24/2003)+1

N

n00batW0rk

A1: '12/25/2003
A2: =A1+3 which gives you 12/28/2003
A3: '12/28/2003


A2 does not equal A3, how can I get A2 to equal A3 without changin
A1??? Thank you in advance!

* Please note apostrophe'
 
J

Jim Rech

A1 and A3 are text while A2 is a number (date). So A2 and A3 are different.
Excel coerced the A1 text to a number to do the math in A2 but you really
should enter dates as dates not text (no apostrophe).
 
G

George Nicholson

When adding 3 to A1 Excel coerces the string in A1 to a number and adds 3 to
it. If successful, this process returns a number.
Therefore, a NUMBER is currently in A2 (as opposed to #VALUE, which is what
an unsuccessful coercion would have returned)

A3 contains TEXT. A text value will never equal what only APPEARS to be the
equivalent numerical value UNLESS you convert one or the other.

A2 = A3 returns FALSE (as you discovered)
A2 = Int(A3) returns TRUE (converts A3 to a
number)
A2 = (A3+ 0) returns TRUE (coerces A3 into a
number by applying addition)
TEXT(A2,"mm/dd/yy") = A3 returns TRUE (converts A2 into the appropriate
text format for comparison to A3)

If you change the formula in A2 to:
=TEXT(A1+3,"mm/dd/yy")
you would be coercing text into a number and converting that number back to
text all in one step and A2 = A3 would return TRUE

Hope this helps,
 

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

Top