Change format of cell to calculate values

craigo298er

New Member
Joined
Jan 16, 2019
Messages
24
I have a sheet that I'm trying to format some columns to find the time difference of, but my data isn't coming out in a good format.

Sme cells that are coming out in format ## hh:mm:ss (such as "01 10:07:09" for day 1 at 10hr 07min 09sec), but I cannot set cell D2-C2 to calculate the differences. What is the formating that I need to put in to do this?

I have tried a custom dd hh:mm:ss or d hh:mm:ss and not working...neither is DATEVALUE()
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
using Power Query you can replace space to dot then set format to Duration and calculate differences
 
Upvote 0
Sounds like those values are text & not numbers.
What does
Excel Formula:
=isnumber(D2)
return?
 
Upvote 0
continue from post#2

Column1Column2Column1Column2Subtraction
01 10:07:0902 03:11:011.10:07:092.03:11:010.17:03:52

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Replace = Table.ReplaceValue(Source," ",".",Replacer.ReplaceText,{"Column1", "Column2"}),
    TypeDuration = Table.TransformColumnTypes(Replace,{{"Column1", type duration}, {"Column2", type duration}}),
    Subtract = Table.AddColumn(TypeDuration, "Subtraction", each [Column2] - [Column1], type duration)
in
    Subtract
 
Upvote 0
In that case if your values always start 01 you can use
Excel Formula:
=RIGHT(D2,8)-RIGHT(C2,8)
otherwise
Excel Formula:
=(LEFT(D2,2)+RIGHT(D2,8))-(LEFT(C2,2)+RIGHT(C2,8))
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,019
Messages
6,122,707
Members
449,093
Latest member
Mnur

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