DATEVALUE QUESTION

C

Carol

I want to convert an entered date using the DATEVALUE funtion to a number.
EX: =Datevalue("8/22/2004") .. However, when I substitute "8/22/2004" for
a cell reference, it won't work. Ex: =Datevalue(B2)

Any ideas please? Thank you!
 
D

Duke Carey

Does B2 contain a text representation of a date, or the date itself?

Sounds like it's the date itself, in which case you can simply refer to the
cell itself (i.e., =B2) as it is already a date serial number.
 
J

JE McGimpsey

If B2 already contains a date, use it as is:

=B2

DATEVALUE will only convert Text. I assume by "won't work" you mean you
get the #VALUE! error, which indicates you're trying to convert numbers
or text that can't be interpreted as a date. If that's not the case,
please post back stating what "won't work" means.
 
W

William Horton

The DATEVALUE function requires that the data type of the argument you enter
to be a TEXT data type. Therefore, if you adjust your formula to the below
it should work for you.

=DATEVALUE(TEXT(B2,"mm/dd/yy"))

If 8/22/2004 is in cell B2 the above formula will produce an answer of 38221.

Hope this helps.

Thanks,
Bill Horton
 
C

Carol

THANKS MUCH!!!

William Horton said:
The DATEVALUE function requires that the data type of the argument you enter
to be a TEXT data type. Therefore, if you adjust your formula to the below
it should work for you.

=DATEVALUE(TEXT(B2,"mm/dd/yy"))

If 8/22/2004 is in cell B2 the above formula will produce an answer of 38221.

Hope this helps.

Thanks,
Bill Horton
 
Top