ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Subtracting date:hour from date:hour (https://www.excelbanter.com/excel-worksheet-functions/42340-subtracting-date-hour-date-hour.html)

[email protected]

Subtracting date:hour from date:hour
 

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


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)


wrote in message
oups.com...

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



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.


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)


"MK" wrote in message
ups.com...
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.



MK

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

brgds
Morten



All times are GMT +1. The time now is 02:45 AM.

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