I'm trying to figure out how to write an IF statement that will be 'true' if a value is in-between two values.
Example:
If value is between 60 and 69.9 return "D"
If value is between 70 and 79.9 return "C"
If value is between 80 and 89.9 return "B"
I have this, but I can't figure out how to modify it so the test is an in-between instead of a less than or greater than.
=IF(A1<60, "F", IF(A1>60, "A", 0))
Best Answer
Keep the inequality signs going in the same direction:
The above works fine as long as there aren't too many cases. But if you had many options, C-,C+,B-,B+... it would be better to use a lookup table instead. For example, if you have a lookup table such as the one below, then
does the same job as nested IFs. The table is also easier to maintain in case of changes: e.g., you decided to move some cutoffs.