range bound factor is ranking system

How do create a formula that penalizes a factor if it deviates from an upper and lower range?

For example if I wanted an “Current Ratio” less than 1 or greater than 3 to be penalized the further outside that range it gets.

Thanks
Tony

Hi Tony,
This would do what you asked.
Eval(Between(CurRatioQ,1,3) ,0, Eval(CurRatioQ<1, 1-CurRatioQ, CurRatioQ-3))
Lower is better.

If you wanted to look at the results in the screener:
showvar(@CurRatioQ,CurRatioQ)
showvar(@b,Eval(Between(CurRatioQ,1,3) ,0, Eval(CurRatioQ<1, 1-CurRatioQ, CurRatioQ-3)))