How to check if a value is in between two values?