# Using IF statements for range of numbers

Topic Labels: Formulas
Solved
2795 4
cancel
Showing results for
Did you mean:
6 - Interface Innovator

Would appreciate some help on IF statements:

I have a field for “WEIGHT” and another for “WEIGHT RANGE”. I would like user to enter his/her weight and need a formula to yield the weight range. eg

42 >> 40-45
48>> 46-50
52>> 51-55
56>> 56-60
63>> 61-65
69>> 66-70

Would there be better alternatives using AND or SWITCH or anything else?

Thank you.

1 Solution

Accepted Solutions
6 - Interface Innovator

[SOLVED]
Thanks so much for this elegant solution. Works beautifully.

4 Replies 4
9 - Sun

try this and see if this will get through the syntax filter.
IF({FIELD NAME} = “42”, “40-45”, IF({FIELD NAME} = “48”, “46-50”, IF({FIELD NAME} = “52”, “51-55”, IF({FIELD NAME} = “56”, “56-60”, IF({FIELD NAME} = “63”, “61-65”, IF({FIELD NAME} = “69”, “66-70”))))))
You dont need your weight range field with this formula

18 - Pluto

A `SWITCH` statement won’t work well because you would have to enter every single possible number. Nested `IF` statements are the way to go in this situation.

``````IF( {weight} <  40, "under 40",
IF( {weight} <= 45, "40-45",
IF( {weight} <= 50, "46-50",
IF( {weight} <= 55, "50-55",
IF( {weight} <= 60, "56-60",
IF( {weight} <= 65, "61-65",
IF( {weight} <= 70, "66-70",
"71+"
)))))))
``````
6 - Interface Innovator

[SOLVED]
Thanks so much for this elegant solution. Works beautifully.

6 - Interface Innovator

Thanks for this. Will try it out. Much appreciated!