C RUBY-ON-RAILS MYSQL ASP.NET DEVELOPMENT RUBY .NET LINUX SQL-SERVER REGEX WINDOWS ALGORITHM ECLIPSE VISUAL-STUDIO STRING SVN PERFORMANCE APACHE-FLEX UNIT-TESTING SECURITY LINQ UNIX MATH EMAIL OOP LANGUAGE-AGNOSTIC VB6 MSBUILD

# How to calculate percentage of value inside arbitrary range?

By : Kshamta Pareek
Date : October 21 2020, 08:10 AM
I wish did fix the issue. Your question isn't clear, but I think you're trying to normalize a list to be between -1 and +1.
This takes the list and normalizes it to 0-2, then shifts the result down to -1 to +1.
code :
``````List<decimal> someNumber = new List<decimal> { 400, 300, 200, 0, -200, -300, -400 };
var range = max - min;
var normalizedList = someNumber.Select(x => 2*(x-min)/(range) - 1).ToList();
``````
``````> normalizedList
List<decimal>(7) { 1, 0.75, 0.5, 0, -0.5, -0.75, -1 }
``````

Share :

## How to calculate percentage within a value range in PHP

By : user503927
Date : March 29 2020, 07:55 AM
I wish this helpful for you I have a value that i need to translate to a percentage given a certain set of rules. , The function can be defined piecewisely:
code :
``````function f(\$x) {
if (\$x >= 200)
return 100;
if (\$x >= 100 && \$x < 200)
return 50 + 50 * ((\$x - 100) / 100);
if (\$x >= 80 && \$x < 100)
return 25 + 25 * ((\$x - 80) / 20);
if (\$x < 80)
return 25 * (\$x / 80);
}
``````

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

By : Don
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , Example: , Well, I would use the formula
code :
``````((input - min) * 100) / (max - min)
``````
``````((65 - 46) * 100) / (195 - 46) = 12.75
``````
``````range = max - min
correctedStartValue = input - min
percentage = (correctedStartValue * 100) / range
``````
``````val = ((percent * (max - min) / 100) + min
``````

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

By : Sygyn
Date : March 29 2020, 07:55 AM
I wish this help you How about mapping this into domain range problem where domain would be your min and max values and range will be from 0 to 100
code :
``````function mapBetween(currentNum, minAllowed, maxAllowed, min, max) {
return (maxAllowed - minAllowed) * (currentNum- min) / (max - min) + minAllowed;
}

console.log (mapBetween(-46,0,100,-46,195))
console.log (mapBetween(195,0,100,-46,195))
console.log (mapBetween(65,0,100,-46,195))
console.log (mapBetween(100,0,100,0,200))``````

## Calculate percentage contribution of a dynamic changing range

By : A. Ibrahim
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , You do not need a macro to get this result; use below formula in C2 and fill it until the end

## Calculate Percentage Based on reverse range

By : Kwag Kuwon
Date : March 29 2020, 07:55 AM