A
A
Anton Melentiev2016-11-18 19:44:01
HTML
Anton Melentiev, 2016-11-18 19:44:01

How to calculate distance as a percentage?

Hello. I've been sitting for 7 hours and I can't find a definite answer!
Essence of the question:
There is a certain range and you need to calculate the position in the interval from A to B of a certain point as a percentage.
100% - 2382
x% - 1568 (can't think of a formula)
0% - 1276
PS
A and B change, need a formula!
help!!!
!!!
No need to write that I'm stupid, just give a number and a solution. With verification, please, there is a snag in it

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2016-11-18
@MaxxxNSK

here is a calculator for you written on js:
https://jsfiddle.net/k9z41L5c/
it turned out about 26%

R
romy4, 2016-11-18
@romy4

well, everything is simple
A - B = interval 100%
interval / 100 = step
x - B = interval from B
interval_from_B / step * 100 = your x%
answer the question, did you finish school?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question