Jump to content
  • 0

Calculating Values from Time - MPH and Pace Per Mile


FishTacos

Question

Hello,

I need to try and figure out how to calculate values from time/distance.  Examples:

1. Calculate miles/hr based on 2 fields: time and distance.  Ex- 1:00:00 (hour) and 20 Miles would be 20mph.

2. Calculate pace per mile based on 2 fields: time and distance.  Ex- 1:00:00 (hour) and 10 Miles would be 6:00/Mile.

Anyone have experience in doing this in Caspio or can offer any help?  I haven't had any luck in making these calculations.  Any help would be greatly appreciated.

Thank you!

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hello @FishTacos,

Since I am not sure how you store the values, I assume that the time field has the Text(255) data type. 

1) In this case, you may try using this formula to calculate miles per hour

[@field:Miles]/(((CAST(Substring([@field:Hours],1,2) as float)*60) + CAST(Substring([@field:Hours],4,2) as float))/60)

Please note, that this formula works if you store the hour as 2-digit number. So, please use leading zero. For example, 01:00:00.

Do not forget to replace the field names with your local names.

2) To calculate pace per mile, please try this formula

((CAST(Substring([@field:Hours],1,2) as float)*60) + CAST(Substring([@field:Hours],4,2) as float))/[@field:Miles]

 

If you provide more details about the field data types, I can offer a more suitable solution.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...