ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Calculating Date difference in 2 ways (https://www.excelbanter.com/excel-discussion-misc-queries/3930-calculating-date-difference-2-ways.html)

Hari

Hi Jim and Aladin,

I have not written my initial query properly.

My doubt is that inspite of the same formulas and with both A1 and B1 having
no previous formating, what causes excel to interpret these 2 approaches as
being different. Is there some logical reason for the same.

Regards,
Hari
India

"Aladin Akyurek" wrote in message
...
Excel's guess of the result type is wrong. Just format the formula cell
as General.

Hari wrote:
Hi,

If in cell A1 I write -- = today() - date(2004,12,31)
then the answer I get is a number ( let's say 14 or 15)

But if in cell B1 If i write -- = C1 - D1
where C1 -- = Today() and D1 -- = date(2004,12,31), the answer I get is
in date format (in excel's 1900 base year)

Why is there a diference in formatting of results between the above 2
approaches.

Regards,
Hari
India




Hari

Calculating Date difference in 2 ways
 
Hi,

If in cell A1 I write -- = today() - date(2004,12,31)
then the answer I get is a number ( let's say 14 or 15)

But if in cell B1 If i write -- = C1 - D1
where C1 -- = Today() and D1 -- = date(2004,12,31), the answer I get is
in date format (in excel's 1900 base year)

Why is there a diference in formatting of results between the above 2
approaches.

Regards,
Hari
India


Jim May

Format Cell (B1) as a Number.

"Hari" wrote in message
oups.com...
Hi,

If in cell A1 I write -- = today() - date(2004,12,31)
then the answer I get is a number ( let's say 14 or 15)

But if in cell B1 If i write -- = C1 - D1
where C1 -- = Today() and D1 -- = date(2004,12,31), the answer I get is
in date format (in excel's 1900 base year)

Why is there a diference in formatting of results between the above 2
approaches.

Regards,
Hari
India




Aladin Akyurek

Excel's guess of the result type is wrong. Just format the formula cell
as General.

Hari wrote:
Hi,

If in cell A1 I write -- = today() - date(2004,12,31)
then the answer I get is a number ( let's say 14 or 15)

But if in cell B1 If i write -- = C1 - D1
where C1 -- = Today() and D1 -- = date(2004,12,31), the answer I get is
in date format (in excel's 1900 base year)

Why is there a diference in formatting of results between the above 2
approaches.

Regards,
Hari
India


Aladin Akyurek

Hari wrote:
Hi Jim and Aladin,

I have not written my initial query properly.

My doubt is that inspite of the same formulas and with both A1 and B1 having
no previous formating, what causes excel to interpret these 2 approaches as
being different. Is there some logical reason for the same.

Regards,
Hari
India

"Aladin Akyurek" wrote in message
...

Excel's guess of the result type is wrong. Just format the formula cell
as General.

Hari wrote:


The second formula references cells whose formats are dates. Excel
apparently uses that format info in its guess what the format of the
result will be.

Hi,

If in cell A1 I write -- = today() - date(2004,12,31)
then the answer I get is a number ( let's say 14 or 15)

But if in cell B1 If i write -- = C1 - D1
where C1 -- = Today() and D1 -- = date(2004,12,31), the answer I get is
in date format (in excel's 1900 base year)

Why is there a diference in formatting of results between the above 2
approaches.

Regards,
Hari
India





Frans van Zelm

Hi Hari,

Some number formats in source cells are echoes in targets. This is a
built-in
feature, weather you like it or not.

E.g.: if you multiply $5 by 2, the result automatically will be $10.

Frans

"Hari" wrote in message
...
Hi Jim and Aladin,

I have not written my initial query properly.

My doubt is that inspite of the same formulas and with both A1 and B1

having
no previous formating, what causes excel to interpret these 2 approaches

as
being different. Is there some logical reason for the same.

Regards,
Hari
India

"Aladin Akyurek" wrote in message
...
Excel's guess of the result type is wrong. Just format the formula cell
as General.

Hari wrote:
Hi,

If in cell A1 I write -- = today() - date(2004,12,31)
then the answer I get is a number ( let's say 14 or 15)

But if in cell B1 If i write -- = C1 - D1
where C1 -- = Today() and D1 -- = date(2004,12,31), the answer I get

is
in date format (in excel's 1900 base year)

Why is there a diference in formatting of results between the above 2
approaches.

Regards,
Hari
India







All times are GMT +1. The time now is 04:23 PM.

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