Transform time in minutes

davidv
davidv
edited 12/09/19 in Formulas and Functions

Our Smartsheet has been build with time entered that way

2h00

0h15

0h15

1h00

3h00

2h00

1h00

0h15

0h15

3h00

0h30

18h00

 

I want to transform that value automatically in minutes (120 / 15 / 15 / 60 / 180 / 120 etc)

 

Any idea on how to do it in smartsheet?

 

thanks

Comments

  • Andrée Starå
    Andrée Starå ✭✭✭✭✭✭

    Hi David,

    Can you share the sheet or some screenshots so that I can get a better understanding of your set up?

    Have a fantastic week!

    Best,

    Andrée Starå

    Workflow Consultant @ Get Done Consulting

    SMARTSHEET EXPERT CONSULTANT & PARTNER

    Andrée Starå | Workflow Consultant / CEO @ WORK BOLD

    W: www.workbold.com | E:andree@workbold.com | P: +46 (0) - 72 - 510 99 35

    Feel free to contact me for help with Smartsheet, integrations, general workflow advice, or anything else.

  • bcwilson.ca
    bcwilson.ca ✭✭✭✭✭
    edited 11/26/18

    Try This:

    Where Time@row is the Column that contains the time

    =VALUE(LEFT(Time@row, FIND("h", Time@row, 1) - 1)) * 60 + VALUE(MID(Time@row, FIND("h", Time@row, 1) + 1, 2))

    In Summary..

    1. We find the "h"

    FIND("h", Time@row, 1) 

    2. We Take the text to the left **remember that it returns where the h is so we need to delete one value

    LEFT(Time@row, FIND("h", Time@row, 1) - 1))

    3. Rember it is text so change it to a value

    VALUE(LEFT(Time@row, FIND("h", Time@row, 1) - 1))

    4. Multiply it by 60 for minutes

    VALUE(LEFT(Time@row, FIND("h", Time@row, 1) - 1)) * 60



    Now add the minutes to it

    A. We find the text after the "h"

    FIND("h", Time@row, 1)

    B. We Take the text to the right

    **remember that it returns where the h is so we need to add one value

    **I am also taking 2 characters

    MID(Time@row, FIND("h", Time@row, 1) + 1, 2)

    C. Rember it is text so change it to a value

    VALUE(MID(Time@row, FIND("h", Time@row, 1) + 1, 2))



    Add 4 to C

    There is no error checking and if I was writing this for Excel it would probably fail but it seems that the error checking within Smartsheet seems to catch it

    Ex. If it is 2h5 minutes even thought I am asking for 2 characters in B it returns 5 not "50"

    would need a length function in B to deal with h120 or more.

     

     

     

  • bcwilson.ca
    bcwilson.ca ✭✭✭✭✭
    edited 11/19/18

    Because I couldn't leave it alone

    Where Time@row is the Column that contains your time



    =VALUE(LEFT(Time@row, FIND("h", Time@row, 1) - 1)) * 60 + VALUE(MID(Time@row, FIND("h", Time@row, 1) + 1, LEN(Time@row) - FIND("h", Time@row, 1)))

    I put a more detailed description and am waiting for it to be approved but this will also work for h120, 2h90, 0.5h, etc...

    Brent C. Wilson

     

  • Hi Brent thanks a lot for the answer.  It works fine at 95%

     

    For example, 0h15 = 15 minutes, and it returns a 0

    and 18h00 returns an #invalid value

    (or if it's easier, i have a time column and also an hour and minutes column)

    thanks

    smartsheet.JPG

  • Not sure if i replied to you on my last reply or i did a simple reply

  • bcwilson.ca
    bcwilson.ca ✭✭✭✭✭

    You should just be able to run the formula on the single 'Travel Time' column.

    =VALUE(LEFT([Temps des traveaux]1, FIND("h", [Temps des traveaux]1, 1) - 1)) * 60 + VALUE(MID([Temps des traveaux]1, FIND("h", [Temps des traveaux]1, 1) + 1, LEN([Temps des traveaux]1) - FIND("h", [Temps des traveaux]1, 1)))

    It works for me with no issues..

    The key in this formula is that it looks for the 'h' and determines the numbers to the left are hours and the numbers to the right are minutes.

    As you can see below

    example.jpg

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!