Subtracting date:hour from date:hour

M

morten.krog

I'm trying to subtract "30.06.05 00:00" from "31.07.05 23:59" and get
number of days and hours as result, but I cant seem to find the right
way to do this.

Im using Office XP (ie. Office 2002).
Any help is appreciated here :)
 
P

Peo Sjoblom

To get the days use =INT(B1-A1)

formatted as general (not date)

where B1 is the later date/time and A1 the earlier, to get the time

=MOD(B1-A1,1), formatted as time



--
Regards,

Peo Sjoblom

(No private emails please)
 
M

MK

Thanks, but its not either days or hours Im after, but both :)

I need to work out a result that tells me how many days and hours there
are between the two times. I need to do further operations on the
result of the subtraction.
 
P

Peo Sjoblom

You can just subtract and then use a custom format, then do whatever
calculations you want, the point is that the value you get is equal to 31
days 18 hours and 59 minutes, just do

=B1-A1

then custom format d tt:mm or d hh:mm whatever format you are using, I get
31 18:59 if I do that

--
Regards,

Peo Sjoblom

(No private emails please)
 
M

MK

Oh, ok I misunderstood your first reply.
Thanks for explaining it, I got it to work :)

brgds
Morten
 

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