ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Why Not in a Single Cell (https://www.excelbanter.com/excel-discussion-misc-queries/446183-why-not-single-cell.html)

James Ravenswood

Why Not in a Single Cell
 
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?

GS[_2_]

Why Not in a Single Cell
 
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



Ron Rosenfeld[_2_]

Why Not in a Single Cell
 
On Mon, 28 May 2012 16:38:33 -0700 (PDT), James Ravenswood wrote:

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"


joeu2004[_2_]

Why Not in a Single Cell
 
"James Ravenswood" wrote:
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.


James Ravenswood

Why Not in a Single Cell
 
On Monday, May 28, 2012 7:38:33 PM UTC-4, James Ravenswood wrote:
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!


All times are GMT +1. The time now is 06:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com