Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7525411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:32:13+00:00 2026-05-30T03:32:13+00:00

I have 400 records to process and they are in the following formats (string):

  • 0

I have 400 records to process and they are in the following formats (string):

3h
24h20min
3h
2d
26min
1h12min
17h35min
6h12min
30s

How do I make a formula that would automatically detect the d, h, min and s and convert into the right hh:mm:ss with hh being eventually higher than 24?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T03:32:15+00:00Added an answer on May 30, 2026 at 3:32 am

    This previous answer of mine will get you part of the way.

    A slight adjustment is:

    =VALUE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(B5,"d"," "),"h",":"),
     "min",":"),"s",""))
    

    And then format the cell as [h]:mm:ss, where [h] means allowing numbers of hours greater than 24 (rather than wrapping around to zero).

    I am not claiming that this formula will work on all your cases. In fact, it fails when you have minutes alone, seconds alone, days and minutes but no hours, etc. But, you ask for “help or clues”, and this should indeed give you a starting point for devising a formula that is appropriate for your circumstances.

    enter image description here

    EDIT Arrrrrhhhh, I couldn’t resist. I made a VBA user-defined function that parses your date strings. It is quite robust and works for all your examples and more — even string with random characters thrown in, e.g. 6d 243min + 7s. Note that you still have to format the cells as [h]:mm:ss.

    enter image description here

    Function ParseDateTime(sTime As String) As Date
    
        Dim i As Long
        Dim identifierPos As Long
        Dim iTimeUnit As Long
        Dim nTimeUnit As Long
        Dim timeUnitCount As Long
        Dim timeUnitIdentifier() As String
        Dim timeUnitDateValue() As Date
        Dim thisDate As Date
    
        ' What are we looking for in the string?
        ReDim timeUnitIdentifier(1 To 4)
        timeUnitIdentifier(1) = "d"
        timeUnitIdentifier(2) = "h"
        timeUnitIdentifier(3) = "min"
        timeUnitIdentifier(4) = "s"
    
        ' What does each of these identifiers mean?
        ReDim timeUnitDateValue(1 To 4)
        timeUnitDateValue(1) = 1 ' value of 1 means 1 day in Date type.
        timeUnitDateValue(2) = TimeSerial(1, 0, 0)
        timeUnitDateValue(3) = TimeSerial(0, 1, 0)
        timeUnitDateValue(4) = TimeSerial(0, 0, 1)
    
        nTimeUnit = UBound(timeUnitIdentifier)
    
        ' Treat each time unit separately
        For iTimeUnit = 1 To nTimeUnit
            ' Try to locate this time unit's identifier
            identifierPos = InStr(sTime, timeUnitIdentifier(iTimeUnit))
            If identifierPos > 0 Then
                ' Found it. Extract the digits that precede the identifier.
                For i = identifierPos - 1 To 1 Step -1
                    If Not (Mid(sTime, i, 1) Like "[0-9]") Then
                        Exit For
                    End If
                Next i
                timeUnitCount _
                    = CLng(Mid(sTime, i + 1, identifierPos - i - 1))
                thisDate = thisDate _
                    + timeUnitCount * timeUnitDateValue(iTimeUnit)
            Else
                ' Identifier not found. Do nothing.
            End If
    
        Next iTimeUnit
    
        ParseDateTime = thisDate
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have like 400 records on my database, suppose this is the first version
I have an application with like 400 records in the database, I have splash
i have opened fancy box with following code $(#tip5).fancybox({ 'width': 400, 'height': 370, 'enableEscapeButton'
I have one mysql table with the following set of records. Product_id reg_price sale_price
I have a table which contains around 400 000 records and which gets called
I have 400 images in my server database. I am able to get those
I have around 400 GB Live mysql Databases on one server and I like
I have more than 400 000 id's in NOT IN statement. Whether it will
I have a square 400 x 400 with a plane projection attached to it
I have a list of 400 strings that all end in _GONOGO or _ALLOC.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.