How to calculate percentage between the range of two values a third value is

后端 未结 4 621
忘掉有多难
忘掉有多难 2021-01-30 00:40

Example:

I\'m trying to figure out the calculation for finding the percentage between two values that a third value is.

Example: The range is 46 to 195. The va

4条回答
  •  长发绾君心
    2021-01-30 01:19

    Well, I would use the formula

    ((input - min) * 100) / (max - min)
    

    For your example it would be

    ((65 - 46) * 100) / (195 - 46) = 12.75
    

    Or a little bit longer

    range = max - min
    correctedStartValue = input - min
    percentage = (correctedStartValue * 100) / range 
    

    If you already have the percentage and you're looking for the "input value" in a given range, then you can use the adjusted formula provided by Dustin in the comments:

    value = (percentage * (max - min) / 100) + min
    

提交回复
热议问题