Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to use a conditional formula with multiple conditions (based on a range of values)?

cperazza
6 - Meteoroid

Hi guys,

 

This is my first week using Alteryx, and despite being an experienced Excel user (and also experienced with Knime), I'm struggling to find a way out using the Formula tool to run a conditional formula to create new values to a new column.

I have a column called [MCL] with a percentage that ranges from 0% to 100% (or 0 to 1). I have to create a new column called [MCL Band] and populate it with a string value depending on the percentage from column [MCL].

From 0 to 24.99% (or 0 to 0.2499) - 'Very Low'

From 25 to 49.99% (or 0.25 to 0.4999) - 'Low'

From 50 to 74.99% (or 0.5 to 0.7499) - 'Medium'

From 75 to 100% (or 0.75 to 1) - 'High'

 

Can anyone help me out here?
(:

 

Cheers

3 REPLIES 3
Blake
12 - Quasar

Try this expression in your formula tool while creating a new column called [MCL Band]: 

 

If [MCL] >= .75

then 'High'

elseif [MCL] >=.5

then 'Medium'

elseif [MCL] >=.25

then 'Low'

else 'Very Low'

endif

 

Good luck!

Qiu
21 - Polaris
21 - Polaris

@cperazza 
Basically same with the approach of @Blake , but I believe we should always consider exceptions.

 

1118-cperazza.PNG

cperazza
6 - Meteoroid

Thanks, @Blake

It worked!

 

@Qiu, thanks for your suggestion. Once I'm working only with a range from 0 to 1, there are no exceptions to that range. But I'll bear in mind your suggestion for other situations where I'm using a similar expression.

Cheers,

Calebe P.

Labels