Help with TIME() Formula

Options

Hello,

I am testing out the TIME() function and working on a formula to determine the amount of hours and minutes elapsed between a Start and Finish columns. I thought I had it figured out, however, I noticed that for my row that has a Start time of 3 pm and a Finish time of 5 pm, it was showing a time difference of "1 hour(s) and 60 minutes." Why is is not showing 2 hours and 0 minutes?

Formula used:
=IFERROR(ROUNDDOWN((TIME(Start@row) - TIME(Finish@row)) * 24) + " hour(s) and " + ([Time Difference - decimal]@row * 24 - INT([Time Difference - decimal]@row * 24)) * 60 + " minutes", " ")

Answers

  • Mr. Chris
    Mr. Chris ✭✭✭✭✭
    Options

    Hi @kelceyg

    This occurs because the TIME() function has limitations for this use case.

    We can explore a different approach.

    Something like this perhaps:

    =IFERROR(INT([Time Difference - decimal]@row * 24) + " hour(s) and " + MOD([Time Difference - decimal]@row * 1440, 60) + " minutes", " ")

    or maybe:
    =IFERROR(INT(([Finish]@row - [Start]@row) * 24) + " hour(s) and " + MOD(([Finish]@row - [Start]@row) * 1440, 60) + " minutes", " ")

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!