number of hours between two date/times

G

Guest

I have tried a number of the responses posted- sorry i can't seem to get it
right!
I want to calculate the number of days and hours between two date time values
e.g.

cell A1 start: 17/01/2006 16:12
cell A2 finish: 25/01/2006 10:00
cell A3 answer: 7 days 18 hrs

and is it possible to leave cells A1 and A2 in dd:mm:yy hh:mm format rather
than 'general'?

thanks for your help-
 
B

Bob Phillips

=INT(A2-A1)&" days "&ROUND(MOD(A2-A1,1)*24,0)&" hours"

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
 
G

Guest

=TEXT(INT(A2-A1),"#")&" Days "&TEXT(24*(MOD(A2-A1,1)),"#")&" hrs."

this formula outputs the total number of days, and rounds the remaining
hours (18 hrs instead of 17 hrs 48 minutes).

You might be having trouble with the way you are inputing your dates. If
you format them to general you should get numbers like this.
38734.675
38742.41667
This is the actual serial number for the dates you specified. If they stay
in date format, that means the cells are actually text strings and not dates
(as far as excel is concerned). You might need to switch the day and month,
and then change the format to
dd/mm/yyyy hh:mm
to get them to show how you want.
 
G

Guest

Bob,

you make me look so stupid :). You posted and got a response in the time it
took me to finish writing my post.

Jason Rackley
 
G

Guest

thanks Sloth, i will try this too
cheers
Theo

Sloth said:
=TEXT(INT(A2-A1),"#")&" Days "&TEXT(24*(MOD(A2-A1,1)),"#")&" hrs."

this formula outputs the total number of days, and rounds the remaining
hours (18 hrs instead of 17 hrs 48 minutes).

You might be having trouble with the way you are inputing your dates. If
you format them to general you should get numbers like this.
38734.675
38742.41667
This is the actual serial number for the dates you specified. If they stay
in date format, that means the cells are actually text strings and not dates
(as far as excel is concerned). You might need to switch the day and month,
and then change the format to
dd/mm/yyyy hh:mm
to get them to show how you want.
 
B

Bob Phillips

The OP is spoilt. 47 minutes and three alternative solutions. Where else do
you get (free) service like that?

Bob
 

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