Convert Cumulative Time / Time Duration to Text or String

bemp87

Board Regular
Joined
Dec 10, 2016
Messages
102
I have a Cumulative Time field that formats as [h]:mm:ss that aggregates time in hours. I am needing to extract the time portion to convert it to a Text or String value. For example, a cumulative time total of 95:31:00 shows as "1/3/1900 11:31:00 PM" in the formula bar which is not what i want. The value 95:31:00 is what i need to load into an MSFT Access database, but it does not accept cumulative totals, so i've been having to convert it manually which is coming extremely time consuming by using the following formula: ="95:31:00". This gets almost impossible when I am working with many rows.

I have tried the TRUNC() function for this and cannot seem to get this to work. Any help would be appreciated.
 

Attachments

  • Mr Excel Help_1.png
    Mr Excel Help_1.png
    179.3 KB · Views: 10

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Upvote 0
Wow. I'm annoyed with myself, I tried this exact thing but left off the square brackets around hh that resulted in the wrong value. This works perfectly and solves a week long headache and has just saved me an insurmountable amount of work. Thank you!!!
 
Upvote 0
Wow. I'm annoyed with myself, I tried this exact thing but left off the square brackets around hh that resulted in the wrong value. This works perfectly and solves a week long headache and has just saved me an insurmountable amount of work. Thank you!!!
Glad to know you solved the problem :giggle:
 
Upvote 0
I'm Curious, is this possible to do programmitcally using vba? I have the following code but it keeps inserting the value as a datetime format instead of a string? The Timestring is not returning as an actual string value capturing the values as "[hh]:mm:ss". What am i Doing Wrong?

VBA Code:
Sub DataCleanse()
    Dim RowNum As Long
    Dim CpH As Double
    Dim StatDate As Date
    Dim EomFlag As Integer
    Dim TimeString As String
  
  
    StatDate = "05/22/2020"
    EomFlag = 0
    RowNum = 2
    For RowNum = 2 To 19
        CpH = Round(Cells(RowNum, 13).Value / (Cells(RowNum, 11).Value * 24), 2)
        TimeString = WorksheetFunction.Text(Cells(RowNum, 11), "[h]:mm:ss")
        Cells(RowNum, 15).Value = CpH
        Cells(RowNum, 16).Value = StatDate
        Cells(RowNum, 17).Value = EomFlag
    Next RowNum
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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