this would be one way...
=ABS(IF((A2/B2)<1,(A2/B2),1-(A2/B2)))