Calculating Duration of a Start/End Time TouchPoint Question

#results

Updated over a week ago

The Start/End Time question type in a TouchPoint, when used in a Results report, creates 2 separate Objects, one for the Start Time entered, and one for the End Time. Both of these values are stored as plain text, making it difficult to calculate the actual duration of time between them.

The following formulas can help you calculate the actual amount of time spent between the Start and End times entered on a TouchPoint response.

  1. Create 3 separate variables in your report with the following formulas, one for Start Time, one for End Time, and one to calculate the difference, substituting your Start Time and End Time Objects for [Start Time] and [End Time]:

    Start Time:
    ​= (ToNumber(Left([Start Time];(Pos([Start Time];":")-1)))*60)+ToNumber(Substr([Start Time];(Pos([Start Time];":")+1);2)) + (If(Right([Start Time];2)) = "PM" And (Left([Start Time];2) <>"12") Then 720)

    End Time:
    ​= (ToNumber(Left([End Time];(Pos([End Time];":")-1)))*60)+ToNumber(Substr([End Time];(Pos([End Time];":")+1);2)) + (If(Right([End Time];2)) = "PM" And (Left([End Time];2) <>"12") Then 720)

    Minutes Spent:

    = [End Time] - [Start Time]

  2. This variable will return the number of minutes between the Start Time and End Time. To convert this to "hours:minutes" format, you can use the following Formula, substituting the name of the Variable you created above for [Minutes Spent]:
    ​=Floor([Minutes Spent]/60)+":"+FormatNumber(Mod([Minutes Spent];60);"00")

Please note that use of these Formulas require that the Start Time and End Time must refer to the same day, and the Start Time must be earlier than the End Time, or you will receive incorrect results.

Did this answer your question?