+ Reply to Thread
Results 1 to 4 of 4

Converting "x hours y minutes" into "z minutes" or "hr:mn"

  1. #1
    Registered User
    Join Date
    04-24-2013
    Location
    Los Angeles
    MS-Off Ver
    Excel X for Mac
    Posts
    2

    Converting "x hours y minutes" into "z minutes" or "hr:mn"

    I have a data set that lists durations in a column as "x hours y minutes". I need to average all the durations. Does anyone know of a formula I can use to take out the words "hours" and "minutes" so that the cells either read "z minutes" or "hr:mn"?

    Thanks so much!

  2. #2
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Converting "x hours y minutes" into "z minutes" or "hr:mn"

    Hello,

    Assuming the "x hours y minutes" is in A1, paste this formula in B1
    Please Login or Register  to view this content.
    This will calculate the minutes

    Paste this formula in C1
    Please Login or Register  to view this content.
    To convert it into hh:mm (they are all numbers not texts, you can do whatever with them)

    And here is a sample file.
    Note that if you put a number with more than 2 digits, the formula will return wrong value (and who put 3 digits number as hours or minutes anyway). Another note is that you don't have to care if minute and hour are plural or not (2 hour and 20 hours, still return the correct amount, don't worry).
    Attached Files Attached Files
    (copy pasta from Ford)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools

    Regards,
    Lem

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Converting "x hours y minutes" into "z minutes" or "hr:mn"

    If you always consistently have "hours" and "minutes" as shown then you can use this formula to convert

    =SUBSTITUTE(SUBSTITUTE(A1," hours ",":")," minutes","")+0
    Audere est facere

  4. #4
    Registered User
    Join Date
    04-24-2013
    Location
    Los Angeles
    MS-Off Ver
    Excel X for Mac
    Posts
    2

    Re: Converting "x hours y minutes" into "z minutes" or "hr:mn"

    Thank you guys so much! Massively helpful!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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