Calculating Date difference in 2 ways

  • Thread starter Thread starter Hari
  • Start date Start date
H

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
 
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
 
Excel's guess of the result type is wrong. Just format the formula cell
as General.
 
Hari said:
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

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 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
 

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

Back
Top