Why Not in a Single Cell

J

James Ravenswood

If I enter:
5/28/2012 in A1
and
02:15:45 in A2
then =A1 + A2 works just fine, but if I enter:
=5/28/2012 + 02:15:45 in a cell I get an error.

Why?
 
G

GS

James Ravenswood explained on 5/28/2012 :
If I enter:
5/28/2012 in A1
and
02:15:45 in A2
then =A1 + A2 works just fine, but if I enter:
=5/28/2012 + 02:15:45 in a cell I get an error.

Why?

Perhaps because you're entering as a formula which Excel can't
evaluate!

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
R

Ron Rosenfeld

If I enter:
5/28/2012 in A1
and
02:15:45 in A2
then =A1 + A2 works just fine, but if I enter:
=5/28/2012 + 02:15:45 in a cell I get an error.

Why?

Because Excel does not interpret your two different types of data entry as being the same.

Entering =5/28/2012 into a cell is different than entering 5/28/2012 into a cell

The latter is interpreted as a date. The former is interpreted 0.0000887531951150241 (5 divided by 28 divided by 2012)

Similarly, entering 2:15:45 into a single cell is interpreted as a time.
Entering =2:15:45 into a cell is interpreted as an illegal range reference.

Try: ="5/28/2012" + "02:15:45"
 
J

joeu2004

James Ravenswood said:
If I enter:
5/28/2012 in A1
and
02:15:45 in A2
then =A1 + A2 works just fine, but if I enter:
=5/28/2012 + 02:15:45 in a cell I get an error.

If you want to enter date and time in one cell, simply write:

5/28/2012 02:15:45

No equal sign; not plus operator. Those are elements of formulas, not
constants.

But if want to know how to write a constant formula of that form (not
recommended), write:

="5/28/2012" + "02:15:45"

It is not recommended because 5/28/2012 might be interpreted as m/d/yyyy or
d/m/yyyy, depending on the regional date form.

In this case, if the regional date form is d/m/yyyy, you would get an error.
But an ambiguous date like "1/2/2012" (intended to mean Jan 2) might simply
be misinterpreted as Feb 1.
 
J

James Ravenswood

If I enter:
5/28/2012 in A1
and
02:15:45 in A2
then =A1 + A2 works just fine, but if I enter:
=5/28/2012 + 02:15:45 in a cell I get an error.

Why?

Thanks to all of you!
 

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