Date Time Comparison

yessir

Board Regular
Joined
Jun 7, 2019
Messages
103
Office Version
  1. 2021
Platform
  1. MacOS
I'm trying to use the data in a pivot table and the information is entered into one cell as dd hh:mm:ss. How would I break this out if I wanted to manipulate the data, would it be with a pivot table or formula? I have two columns next to each other with dd hh:mm:ss format with different times and I want to calculate the time elapsed between them. Anything helps!
 
That means they're text strings, not date/time data type. Try this.
Book1
ABCDE
1Time1Time2Days1Days2Difference in hours
22 4:30:012 5:01:012.1882.2090.52
34 23:55:005 00:25:004.9975.0170.50
45 22:12:006 01:00:005.9256.0422.80
51 12:00:011 17:00:001.5001.7085.00
Sheet2
Cell Formulas
RangeFormula
C2:D5C2=LET(space,FIND(" ",A2),t,--LEFT(A2,space-1)+--TRIM(MID(A2,space+1,8)),t)
E2:E5E2=(D2-C2)*24
 
Upvote 0

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
That does work. Is Column E able to be formatted into hh:mm:ss?
 
Upvote 0
Yes. Leave column E in days i.e. don't multiply by 24. Ctrl + 1 -> Format cells -> Custom -> [h]:mm:ss
Book1
ABCDE
1Time1Time2Days1Days2Difference in hours
22 4:30:012 5:01:012.1882.2090:31:00
34 23:55:005 00:25:004.9975.0170:30:00
45 22:12:006 01:00:005.9256.0422:48:00
51 12:00:011 17:00:001.5001.7084:59:59
Sheet2
Cell Formulas
RangeFormula
C2:D5C2=LET(space,FIND(" ",A2),t,--LEFT(A2,space-1)+--TRIM(MID(A2,space+1,8)),t)
E2:E5E2=D2-C2
 
Upvote 0
Hi, here's another option you could also try:

Book1
ABCD
1Time1Time2Difference in hours
22 4:30:012 5:01:010:31:00<Formated with [h]:mm:ss
34 23:55:005 00:25:000:30:00
45 22:12:006 01:00:002:48:00
51 12:00:011 17:00:004:59:59
Sheet1
Cell Formulas
RangeFormula
C2:C5C2=("1900-1-"&B2)-("1900-1-"&A2)
 
Upvote 0
Try this:

Book1
ABC
1Time1Time2Difference in hours
24:30:013 4:30:0172:00
334 23:55:0035 00:25:000:30
450 22:12:0051 01:00:002:48
531 12:00:0132 17:00:0028:59
Sheet1
Cell Formulas
RangeFormula
C2:C5C2=IFERROR(LEFT(B2,FIND(" ",B2)-1),0)+IFERROR(MID(B2,FIND(" ",B2)+1,8),B2)-IFERROR(LEFT(A2,FIND(" ",A2)-1),0)-IFERROR(MID(A2,FIND(" ",A2)+1,8),A2)
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,264
Members
452,627
Latest member
KitkatToby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top