FACER Community

Code for converting steps to miles

I figured out how to convert steps to miles (#ZSC#/2000), but how do I keep it to only 2 places to the right of the decimal? What is the formula? Thanks.

((round(x*100))/100)

Question, then should be ((#ZSC#/2000)((round(x*100))/100))?

Hi @Nerioalberto , I do use following calculation

((round((#ZSC#*0.0476)))/100)

Thank you! I def will be using it on my designs

Do you know of any definitive reference for your preferred stride length and (therefore) steps per mile/kilometre multiplier values?

For example: (one of multiple sources, all fairly contradictory)

https://www.thecalculatorsite.com/articles/units/how-many-steps-in-a-mile.php

For an average person:

    1 mile = 2,000 steps
    1 km = 1,250 steps

But, different for ‘walking’ or ‘running’, for women or men, or tall vs. short people …

if average person:
if 1 mile = 2000 steps
so 1 mile / 2000 steps = 0.0005 mile in 1 steps

(floor((#ZSC#*0.0005)*100)/100) mile

if 1 km = 1250 steps
so 1 km / 1250 steps = 0.0008 km in 1 steps

(floor((#ZSC#*0.0008)*100)/100) km

hope this help :slight_smile:

2 Likes

Hi @andrew.dowden,

as @Ben writes the calculation could be easy.

I do use also a bit another formulas (approximations) with some decimals to be more precious:

TOMAJA Miles Calculation :wink:

((round((#ZSC#*0.0476)))/100)

TOMAJA Kilometers Calculation :wink:

((round((#ZSC#*0.00762)))/10)

:runner: Let rock the sport! :runner:

3 Likes

Thanks all!

Hi every1, I’m new here to Facer. Made a few watch faces, having some trouble with the expression for step count. I have used the info from @ic_bones and @Mellin about converting steps to miles, and then rounding the number to two decimal places. Please can some1 check my expression?

Steps to Miles - ((round((#ZSC#/2500)*100))/100)
I used 2500 steps for a mile as I have a shorter stride length.

I then converting steps to calories:

Steps to Calories - ((round(((#ZSC#/2500)*140)*100))/100)
I used 140 calories for 1 mile and then added the steps to miles from before.

Are these two expressions correct? On my Facer Design App when I slide the timeline, the calories and miles expressions change accordingly as they should. But on my phone it only shows 0 calories and 0 miles. I added the step counter expression that was default from the Add Element drop down menu, but that that step count expression doesn’t work on my phone either, only in the Facer Design App. What could be the problem.

Any and all help will be appreciated. Thanks

Sorry I copied the expressions wrong, they are:

((round((#ZSC#/2500)*100))/100) Miles

((round(((#ZSC#/2500)*140)*100))/100) Calories

((round((#ZSC#/2500)*100))/100) Miles
((round(((#ZSC#/2500)*140)*100))/100) Calories

Sorry again, everytime I post I lose the * sign after 140 and 100 in the Steps to Calories expression

((round((#ZSC#/2500)*100))/100) Miles
((round(((#ZSC#/2500)*140)*100))/100) Calories

@farhan1mirza,
You should check with @eradicator09. I beleive he put a chart together last year for steps/miles (and height)

Jonh

Just use ‘Preformatted text’ (or <Ctrl-Shift-Q>), like so:

((round((#ZSC#/2500)*100))/100) Miles
((round(((#ZSC#/2500)*140)*100))/100) Calories

1 Like

Whenever I plug in the formula: ((round((#ZSC#/2500)*100))/100) Miles. It doesnt seem to change when I slide the amount of steps taken. Is this an error with facer or with the formula?