+ Reply to Thread
Results 1 to 7 of 7

Tekst to hours

  1. #1
    Registered User
    Join Date
    07-16-2015
    Location
    Nederland
    MS-Off Ver
    2010
    Posts
    33

    Tekst to hours

    Hi all,

    I have a overview of time spent and written like this:

    4 days, 5 hours, 19 minutes
    1 day, 1 hour
    7 hours, 5 minutes
    2 hours
    1 hour
    30 minutes

    I would like to convert it to hours.

    example (1 day = 8 hours):
    1 day, 1 hour = 9
    30 minutes = 0.5

    Column B should only give the amount of hours. See attached

    I use Excel 2010
    Attached Files Attached Files
    Last edited by Milcoi; 09-03-2015 at 03:27 AM.

  2. #2
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Tekst to hours

    =IFERROR(TRIM(MID(SUBSTITUTE(","&A2,",",REPT(" ",LEN(A2))),FIND("day",SUBSTITUTE(","&A2,",",REPT(" ",LEN(A2))))-LEN(A2),LEN(A2))),0)*8+
    IFERROR(TRIM(MID(SUBSTITUTE(","&A2,",",REPT(" ",LEN(A2))),FIND("hour",SUBSTITUTE(","&A2,",",REPT(" ",LEN(A2))))-LEN(A2),LEN(A2))),0)+
    IFERROR(TRIM(MID(SUBSTITUTE(","&A2,",",REPT(" ",LEN(A2))),FIND("min",SUBSTITUTE(","&A2,",",REPT(" ",LEN(A2))))-LEN(A2),LEN(A2))),0)/60
    Please Login or Register  to view this content.
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,101

    Re: Tekst to hours

    Try this out:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Tekst to hours

    =TEXT((IFERROR(TRIM(MID(SUBSTITUTE(","&A2,",",REPT(" ",LEN(A2))),FIND("day",SUBSTITUTE(","&A2,",",REPT(" ",LEN(A2))))-LEN(A2),LEN(A2))),0)*8+
    IFERROR(TRIM(MID(SUBSTITUTE(","&A2,",",REPT(" ",LEN(A2))),FIND("hour",SUBSTITUTE(","&A2,",",REPT(" ",LEN(A2))))-LEN(A2),LEN(A2))),0)+
    IFERROR(TRIM(MID(SUBSTITUTE(","&A2,",",REPT(" ",LEN(A2))),FIND("min",SUBSTITUTE(","&A2,",",REPT(" ",LEN(A2))))-LEN(A2),LEN(A2))),0)/60)/24,"[H]:MM")
    Please Login or Register  to view this content.

  5. #5
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Tekst to hours

    Quote Originally Posted by Glenn Kennedy View Post
    Try this out:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Good Idea Glen
    Don't think otherwise, I modified your formula (I really impressed with the formula / idea)
    =TRIM(IFERROR(LEFT(A2,SEARCH("Day",A2)-1),0))*8+LOOKUP(60,--RIGHT(TRIM(IFERROR(LEFT(A2,SEARCH("HOUR",A2)-1),0)),{1,2}))+LOOKUP(60,--RIGHT(TRIM(IFERROR(LEFT(A2,SEARCH("mIN",A2)-1),0)),{1,2}))/60
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    07-16-2015
    Location
    Nederland
    MS-Off Ver
    2010
    Posts
    33

    Re: Tekst to hours

    thanks for the quick answers, I downloaded Glann's file and is working. As soon as I copy and paste the modified formula from NFLsales Excel keeps telling formula is wrong. Any change to upload a excel example with new formula?

    Done:
    Please Login or Register  to view this content.
    Last edited by Milcoi; 09-03-2015 at 06:10 AM.

  7. #7
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Tekst to hours

    See the attached file
    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. [SOLVED] Take over tekst Yes or No
    By Jos vd Heijden in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-08-2015, 04:07 AM
  2. Matrix Tekst
    By DriesB in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-03-2014, 11:48 AM
  3. [SOLVED] Convert tekst to data for calculation
    By lentebriesje in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-29-2013, 01:44 AM
  4. Changing tekst mm:ss to decimal time
    By DeBossman in forum Excel General
    Replies: 2
    Last Post: 05-07-2012, 09:12 AM
  5. Load tekst with combobox
    By vds in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-06-2010, 06:57 AM
  6. [SOLVED] Tekst in een tekstfile wijzigen met VBA Excel
    By pieros in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-27-2005, 04:58 AM
  7. import tekst >65536 rows
    By Reniek in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-22-2005, 06: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