+ Reply to Thread
Results 1 to 6 of 6

Converting a text and number time into a numerical value and converting to minutes

  1. #1
    Registered User
    Join Date
    10-06-2020
    Location
    Vancouver, BC
    MS-Off Ver
    MS Office 2016
    Posts
    2

    Cool Converting a text and number time into a numerical value and converting to minutes

    Hi,

    I am a very novice excel user and I am trying to solve I think a fairly complex formula.

    I am creating a spread sheet from data that is extracted from another program. That program creates a cell for total usage time in the following format: eg. "2d 8h 35m" some will not have the days or hours depending on the amount of time in use "20h 6m" or "45m".

    I have approx. 67 columns with the usage times. I would like to get a total at the end.

    I have been trying to create a formula that will remove the letter and then convert the "days, hours and min" to straight minutes or one that will add all the cells and move excess min to hours and hours to days.....

    I am not even sure where to start. Best I have managed so far is to remove one letter using the substitute formula. I have tried searching the web for help but that seems futile.....

    Any suggestions or help would be appreciated.
    Last edited by RQuilley; 10-07-2020 at 11:03 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Converting a text and number time into a numerical value and converting to minutes

    Please read the yellow banner at the top of this page on how to attach a file.

    Once we get a sample file, we can show you the solution.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Converting a text and number time into a numerical value and converting to minutes

    A
    B
    C
    D
    E
    F
    G
    H
    1
    as text
    as numbers
    2
    days
    hours
    minutes
    days
    hours
    minutes
    IN MINUTES
    3
    2d 18h 45m
    2d
    18h
    45m
    2
    18
    45
    66:45
    4
    20h 35m
    0
    20h
    35m
    0
    20
    35
    20:35
    5
    17m
    0
    0
    17m
    0
    0
    17
    0:17
    6
    17d 23h 59m
    17d
    23h
    59m
    17
    23
    59
    431:59
    7
    3h 55m
    0
    3h
    55m
    0
    3
    55
    3:55


    It is 1 AM, so forgive me some monster formula:

    B3:
    Please Login or Register  to view this content.
    C3:
    Please Login or Register  to view this content.
    D3:
    Please Login or Register  to view this content.
    and the rest

    E
    F
    G
    H
    1
    as numbers
    2
    days
    hours
    minutes
    IN MINUTES
    3
    =IFERROR(LEFT(B3,FIND("d",B3)-1),0)
    =IFERROR(LEFT(C3,FIND("h",C3)-1),0)
    =IFERROR(LEFT(D3,FIND("m",D3)-1),0)
    =E2+F2/24+G2/1440

    I am sure that some magician make it much, much simpler.
    Last edited by KOKOSEK; 10-08-2020 at 07:39 AM.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Converting a text and number time into a numerical value and converting to minutes

    With text in A2
    First, try to combine text with "d,h,m" to ensure all d,h,m exist
    "000"&A2&"000d000h000m"
    then for "d" calculation

    AGGREGATE(14,6,RIGHT(LEFT("000"&A2&"000d000h000m",SEARCH("d","000"&A2&"000d000h000m")-1),{1,2,3})+0,1)

    similar to "h" and "m", then sum them up:

    Please Login or Register  to view this content.
    Attached Images Attached Images
    Attached Files Attached Files
    Quang PT

  5. #5
    Registered User
    Join Date
    10-06-2020
    Location
    Vancouver, BC
    MS-Off Ver
    MS Office 2016
    Posts
    2

    Re: Converting a text and number time into a numerical value and converting to minutes

    Thank you for the reply, this seems to work. Am going to see if I can get it to work on my entire sheet. I am confident I can convert this back to days hours min if I needed to but I like the hh:mm format this ends up in.

    I sure wish I could learn to use excel better. I have taken a few days of basic courses, and I am working on more classes as time and covid permit. Once I confirm this works out I will mark as solved.

    Thanks again for the help

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Converting a text and number time into a numerical value and converting to minutes

    Please try

    =SUMPRODUCT((TEXT(MID(0&A2,FIND({"d","h","m"},0&A2&"dhm")-2,2),"0;;;\0")/{1,24,1440}))
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. converting text time values to minutes
    By td3201 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-14-2018, 04:14 PM
  2. [SOLVED] Converting Standard Time format (hh:mm:ss) to number of minutes
    By xygrax in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-27-2014, 10:54 AM
  3. converting minutes to time
    By tommy060289 in forum Excel General
    Replies: 3
    Last Post: 03-09-2012, 12:20 PM
  4. Converting hours and minutes in military time to minutes
    By Argile79 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-13-2010, 02:42 PM
  5. converting a number to time formatted as minutes
    By JR in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-09-2006, 03:35 PM
  6. converting from text to numerical number
    By james in forum Excel General
    Replies: 1
    Last Post: 02-01-2005, 10:06 PM
  7. Time - converting HH:MM:SS to Minutes
    By Noel S Pamfree in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-08-2005, 01:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1