I am using following formula to normalize number:

new = ((current - low) / (high - low)) * 100

But i need middle number to be the mode of the data. So in this case i will give you real example:

low range: 119.09
high range: 121.56
middle: 120.95

high-middle = 0.61
low-middle = 1.86

If I go with my initial formula, 50 is not equal to my middle range. There are two parts here. Values greater than 50 and lower than 50. Is there a way to make this work? I know it's a bit complicated but this is what i'm trying to do.


You could try something like this (in pseudocode)

if (current <= middle) 
    if (middle == low) 
        new == 50
        new = ((current - low) / (middle - low)) * 50 
    if (middle == high)
        new == 50
        new = 50  + ((current - middle) / (high - middle)) * 50 

which avoids division by zero when middle could be equal to low or high. If that cannot happen then you only really need the two long lines


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.