cancel
Showing results for
Did you mean:  Helper II

## If statement with values summarise from 4 choices

H I have a text field that is calculating a few fields charttxt.Text - I want with another field tell with in a range or to summarise from 4 choices depending on the number resulted

``````With({input:Value(charttxt.Text)},
If(input >= 3, "Low",
input >= 4, "Intermediate",
input >= 9, "High",
input >= 15, "Very High",

"1"
)
)``````

I am only getting low or for example 1 when no score?

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions  Super User

Now let's say the input is 5. Then it satisfies the 1st condition because 5 is greater than 3. That's why you always get Low. Try this code instead.

With(
{input: Value(charttxt.Text)},
If(
input >= 3 && input < 4,
"Low",
input >= 4 && input < 9,
"Intermediate",
input >= 9 && input < 15,
"High",
input >= 15,
"Very High",
"1"
)
)

4 REPLIES 4  Super User

Hi @mezcalbean ,  Super User

Now let's say the input is 5. Then it satisfies the 1st condition because 5 is greater than 3. That's why you always get Low. Try this code instead.

With(
{input: Value(charttxt.Text)},
If(
input >= 3 && input < 4,
"Low",
input >= 4 && input < 9,
"Intermediate",
input >= 9 && input < 15,
"High",
input >= 15,
"Very High",
"1"
)
)  Helper II

Thank you @Abhilash_Swain I will try and learn Switch - I have only just come across this  Helper II

Thank you @zmansuri that worked as I wanted, I was unsure how to put a between in.

Thank you   