Formulas for Calculating Time

1567810

Comments

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    @GarrettDyer It is a read only HTML sheet, so I cannot see any of the underlying formulas.

    thinkspi.com

  • GarrettDyer
    edited 03/04/22

    @Paul Newcome Here is the sheet. I worked on it quite a bit and think I have everything lined out. I'm not sure that I have any issues with it as of now. Except of the last two columns with Smartsheet changing the time to PST instead of the CST that is my current time zone.

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    @GarrettDyer I believe there may also be a solution tucked away somewhere in this thread that should help you adjust for the time zone issue.

    thinkspi.com

  • @Paul Newcome I have seen the formulas, the issue comes up that the change is not consistent to PST. If I write the formulas to make the adjustment and the times are in CST then I will have the issue for calculations, just reversed.

    If you check the cell history in the "Time Changed" column you will see the events where Smartsheet Automation is making the changes and messing things up.

  • Jimrny
    Jimrny
    edited 05/17/22

    @Paul Newcome

    Any chance you can help? Trying to get the Duration to reflect the difference between start and stop (shown in minutes) in hh:mm if possible?


  • Jeff Reisman
    Jeff Reisman ✭✭✭✭✭

    @Jimrny Looks like you've already got it. Just replace the " hrs " in your formula with ":" -


    Regards,

    Jeff Reisman, IT Business Analyst & Project Coordinator, Mitsubishi Electric Trane US

    Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages

  • L_123
    L_123 ✭✭✭✭✭✭
    edited 05/17/22

    if you want to have the "HH" part of it, you need a conditional with a len to put a zero. Basically a duplicate of the formula

  • Jimrny
    Jimrny
    edited 05/17/22

    Whoops, so the issue I'm getting is my duration seems off slightly.


    Instead of 59 minutes, it's reflecting 1 hour and 59 minutes?

    I am looking to reflecting "XX hrs XX mins" under duration. Seems to be rounding up and adding the hour before hand.

    Update: It looks like it reflects the hour properly after 60 minutes. What could be causing the additional hour displayed at 59 minutes?

  • L_123
    L_123 ✭✭✭✭✭✭

    try using rounddown() instead of round

  • Can anyone assist to see if this formula is correct for pulling minutes? For some reason I'm not sure if it's calculating the correct minutes.


  • Jeff Reisman
    Jeff Reisman ✭✭✭✭✭

    @Jimrny For some reason, when using MOD on a negative number, it's giving you the wrong portion of the remainder. MOD(-136, 60) should be 16, but it gives you 44. MOD(-148, 60) gives you 32 instead of 28. What these have in common is that if you subtract MOD's calculation from 60, you get the right number of minutes. 60-44 = 16, 60-32 = 28.

    So add an IF to your formula to include that 60 minus calculation in when the [email protected] < 0 :

    =IF([email protected] < 0, ROUND([email protected] / 60, 0) + ":" + (60 - MOD([email protected], 60)), ROUND([email protected] / 60, 0) + ":" + MOD([email protected], 60))

    Regards,

    Jeff Reisman, IT Business Analyst & Project Coordinator, Mitsubishi Electric Trane US

    Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages

  • @Jeff Reisman , that worked out perfectly! Maybe you could assist with this? For some reason I believe anything over 30 - 59 minutes in Difference is showing an extra hour in Duration.



  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    @Jimrny Did you try @L_123's suggestion of using ROUNDDOWN instead of ROUND?

    thinkspi.com

  • Just applied, will test and see at 30, 45 and 59 minutes.

  • @Paul Newcome I have read through all 10 of these pages (thanks so much for putting this all together) and I still am having issues. I have used the move row suggestion to get a date time stamp for when a request is completed. I then use a vlookup to get the completed date/time stamp into my main sheet. I am trying to calculate a TAT from Created to Completed, but a simple Completed-Created won't work. Most of the TAT will be same day, but many will not be. I have tried various other solutions, like the one to extract the date in one field & time in another for each of the Create and Completion date/time stamps. This works for the Created date but for the date I get from the vlookup I get an "Invalid Data Type". I have added +"" to the end of my Completed vlookup formula to get the time to populate. Any ideas on what I am doing wrong? Thanks so much for any help.