+ Reply to Thread
Results 1 to 4 of 4

Convert time from format 1.xx or 0.xx hours to x hours and xx minutes or xx minutes

  1. #1
    Forum Contributor
    Join Date
    09-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    298

    Convert time from format 1.xx or 0.xx hours to x hours and xx minutes or xx minutes

    I store hours in decimal form.

    I would like a simple script that would take hours stored in xx.xx format and convert it to plain text hours/minutes

    for example 1.5 would become "1 hour and 30 minutes"

    0.5 would become "30 minutes"

    etc.

    No rounding is required, for example:

    0.63 would become 21.6 minutes, etc

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Convert time from format 1.xx or 0.xx hours to x hours and xx minutes or xx minutes

    How about this? This is a worksheet change event that runs automatically as you enter data. It has the focus set to A1:A50, and will only attempt to change cells with numbers in them, as opposed to strings.

    Please Login or Register  to view this content.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Forum Contributor
    Join Date
    09-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    298

    Re: Convert time from format 1.xx or 0.xx hours to x hours and xx minutes or xx minutes

    Quote Originally Posted by daffodil11 View Post
    How about this? This is a worksheet change event that runs automatically as you enter data. It has the focus set to A1:A50, and will only attempt to change cells with numbers in them, as opposed to strings.

    Please Login or Register  to view this content.
    Unfortunately I can't work with a worksheet change because data is calculated off the cells. Unless there is a way to somehow "display" the converted value while keeping the original value the same for calculation purposes.

    The method I had in mind was something along the lines of:
    Please Login or Register  to view this content.
    I think that script would work, I just don't know how to tell Excel to do "if whole number" or get it to refer specifically to numbers before or after the decimal, regardless of the length of digits.

  4. #4
    Registered User
    Join Date
    03-06-2006
    Location
    South Central Pennsylvania
    MS-Off Ver
    MS Office Pro Plus 2016, on Window 10
    Posts
    27

    Re: Convert time from format 1.xx or 0.xx hours to x hours and xx minutes or xx minutes

    Here is my simple method. Do some searching on this site. I saw a much better way only a week or two ago.

    Please Login or Register  to view this content.
    I think you can change this to create whatever format you like (e.g., hh/mm, hh/mm/ss, hh.mm, etc.)
    Last edited by jdawson; 09-21-2015 at 02:04 PM. Reason: Removed one extra Dim statement

+ 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. convert days hours minutes seconds to just minutes
    By hollylynn in forum Excel General
    Replies: 4
    Last Post: 08-28-2015, 08:53 AM
  2. Excel 2007 : Convert number of minutes to hours and minutes
    By MikeFromIndy in forum Excel General
    Replies: 30
    Last Post: 06-05-2015, 08:10 AM
  3. Convert Days:Hours:Minutes:seconds to minutes.
    By Kevingardner1 in forum Excel General
    Replies: 4
    Last Post: 06-03-2014, 06:44 PM
  4. Replies: 1
    Last Post: 08-08-2013, 09:21 AM
  5. [SOLVED] Convert Decimal Hours into Hours and Minutes in HH.mn format
    By Cortlyn in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-04-2013, 03:48 PM
  6. Replies: 13
    Last Post: 05-03-2013, 08:42 PM
  7. [SOLVED] time:to convert minutes into hours
    By [email protected] in forum Excel General
    Replies: 4
    Last Post: 06-24-2005, 10:05 AM
  8. [SOLVED] Convert hours and minutes in time format into fractions of hours..
    By Akern in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-21-2005, 10:06 AM

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