+ Reply to Thread
Results 1 to 8 of 8

Data conversion

  1. #1
    Registered User
    Join Date
    11-17-2009
    Location
    Bangalore India
    MS-Off Ver
    Excel 2003
    Posts
    3

    Post Data conversion

    Can you let me know how we can change data in the following format to hours,

    format that is sent to me is 1d 17h 29m, how can i change this into hours and minutes?

    only hours and minutes please.

    Regards
    Basri

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Data conversion

    If that text string is in A1, then this:

    =LEFT(A1,FIND("d",A1)-1)*24+MID(A1,FIND(" ",A1)+1,FIND("h",A1)-FIND(" ",A1)-1)&"h" & MID(A1,FIND("h",A1)+1,10)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Data conversion

    Hi,

    with A1 showing the text string

    1d 17h 29m

    you can use

    Please Login or Register  to view this content.
    and format with custom format "[h]:mm"

    The result is 41:29 = 41 hours and 29 minutes.

    If you don't want to show anything greater than 24 hours, use

    Please Login or Register  to view this content.
    and format with custom format "[h]:mm"

    The result is 17:29

    The above formula works under the assumption that the input format is

    xd xh xs
    or
    xxd xxh xxs

    one or two digits per day, hour, minute.

    cheers
    Last edited by teylyn; 11-17-2009 at 06:54 AM.

  4. #4
    Registered User
    Join Date
    11-17-2009
    Location
    Chennai
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Data conversion

    Hi Excel Master's,

    Instead of FIND formula, you can use SEARCH. Find is case sensitive. Use this formula.

    =TIME(MID(A1,SEARCH("d",A1)+2,(SEARCH("h",A1)-SEARCH("d",A1))-2),SUBSTITUTE(MID(A1,SEARCH("h",A1)+2,99),"m",""),0)

  5. #5
    Registered User
    Join Date
    11-17-2009
    Location
    Bangalore India
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Data conversion

    Hi i did manage to try the formula, but its not taking the formula correctly .


    My data is in the H1 coloumn and i did change all A1 to H1, but still no success .


    again example of the format is : 1d 17h 29m

    thank you for your help in advance.

    Regards
    Basri

  6. #6
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Data conversion

    but its not taking the formula correctly .
    post a data sample in a workbook

  7. #7
    Registered User
    Join Date
    11-17-2009
    Location
    Bangalore India
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Data conversion

    Hi,

    The below mentioned formula is exactly what I am looking for, but need a slight correction in this.

    when i give a value for example 1d 17h 29m, the output that i get is 17h 29 min, but its not adding the 1 day to it, when the correct outpu should have been 41:29,

    Please help

    Regards


    Quote Originally Posted by friendyousuf View Post
    Hi Excel Master's,

    Instead of FIND formula, you can use SEARCH. Find is case sensitive. Use this formula.

    =TIME(MID(A1,SEARCH("d",A1)+2,(SEARCH("h",A1)-SEARCH("d",A1))-2),SUBSTITUTE(MID(A1,SEARCH("h",A1)+2,99),"m",""),0)

  8. #8
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Data conversion

    well, read JBeaucaire's and my first post again, then! It's all there for the taking.

    The "below mentioned formula" is a copy of my first formula, using SEARCH instead of FIND, but omitting the day part.

    Unfortunately, you did not specify in your original post how you want to handle days. In fact, you stated

    only hours and minutes please.
    So, there you go. Still, I gave you a version that delivers:

    The result is 41:29 = 41 hours and 29 minutes.
    It's all up there. We took the trouble to provide solutions. Several. Now please take the trouble and read them.
    Last edited by teylyn; 11-17-2009 at 07:01 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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