Writing a conditional formula with greater than and less than