Difference in dates in Excel 2007

P

pcor

Cell b1= 25 Sept 2007
Cell b2= 23 Sept 2007
Both cells are formatted as shown
With the following formula in B3 (B1-b2) I get answer of 3. I thought the
answer would be 2.
Can you tell me why oir how to fix it
Thanks
 
J

JE McGimpsey

If you format the cells as General, do they have a fractional part? XL
stores date/times as integer/fractions, and calculations depend only on
the stored values, not the displayed values.

So, for instance, if

B1: 25 Sept 2007 23:59
B2: 23 Sept 2007 00:00
B3: =B1-B2 ===> 2.999305556

which will round to 3 if less than 3 decimals are specified.
 
P

Peo Sjoblom

Formatted yes but what do the cells contain?

Put this in D1 and copy down to D2

=TEXT(B1,"General")

or just format B3 as general



--


Regards,


Peo Sjoblom
 
B

Bob Phillips

It's 2 in mine. Are you sure you don't have times as well which takes it up
to 2.nnn such that it displays rounded up?
--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
P

pcor

I guess I misled all of you in B1 I have =@now()..Which turns out to ne 25
Sept 2007.
My question is this : What do I haveto do to get the answer 2
Thanks
 
P

Peo Sjoblom

Use TODAY() instead of NOW() or if you need NOW in some other calculation
use

=INT(B1)-INT(B2)



--


Regards,


Peo Sjoblom
 
P

pcor

That did it real well. Many thanks to all
I really appreciate the good help I can get here. Thanks again
 

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