• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 275
  • Last Modified:

Convert difference with dates and time to days hours amd minutes

I want to convert the difference between two cells which contain dates into days, hours and minutes.
e.g.

30/7/2012 12:00
02/8/2012 13:15

to

3 Days 01:15

Can you give me a formula for this please?

Thanks
0
GordonMasson
Asked:
GordonMasson
  • 2
  • 2
1 Solution
 
nutschCommented:
use formula
=a2-a1

then format that cell with the custom format
d "Days" hh:mm

Cells \ Format \ Format cells
Number \ Custom \ type in the format I gave you

Thomas
0
 
GordonMassonAuthor Commented:
Hi Thomas

Thats what i tried and when you do the calculation, the cell does give you the correct number of days.

When you try to format it its fine if it doesnt roll over a month but when it does the format to d "Days" hh:mm is incorrect.

e.g.
30/07/2012 12:00
02/08/2012 13:15

will give you
3Days 01:15


But
30/07/2012 12:00
02/09/2012 13:15

will also give you
3Days 01:15
0
 
nutschCommented:
Then you can use this, knowing that it's no longer a number field and can't be added, sorted, etc. as such.

=INT(A2-A1) & " Days " & TEXT(A2-A1,"hh:mm")

Thomas
0
 
GordonMassonAuthor Commented:
Thanks Thomas
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now