Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

Replace range of numbers into a string

astro90
5 - Atom

Hi I am quite new to Alteryx

I have a lot of rows containing a number between 0-1000

I want to split them up in 3 categories 

0-180

 

180-275

 

275 or over

 

with a string on each category. I am really lost on how to solve it.

Thank you in advance!

 

4 REPLIES 4
markcurry
12 - Quasar

You should be able to add a Formula tool to create a new field.  A formula along these lines should work :

 

IF [Number] >= 250 THEN
"Category 3"
ELSEIF [Number] > 180 THEN
"Category 2"
ELSE
"Category 1"
ENDIF

 

Hope that helps.

Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @astro90,

 

You could use this expression in a formula tool:

 

IF ToNumber([Value]) >= 275 THEN 'String 1'
ELSEIF ToNumber([Value]) >= 180 THEN 'String 2'
ELSE 'String3'
ENDIF

 

 

image.png

 

If this solves your issue please mark the answer as correct, if not let me know! I've attached my workflow for you to download if needed.

 

Regards,

Jonathan

AMansour
11 - Bolide

Hello @astro90 

 

If your category ranges are fixed I'll go certainly with Formula tool here is the syntax :

 

if [Row Name] < 180 then "Category Name" elseif [Row Name]>= 180 && [Row Name]< 275 then "Category Name" else "Category Name" endif 

 If you want applicate this formula in multiple fields so you need to use Multi-Field Formula with the bellow syntax:

 

if [_CurrentField_] < 180 then "Category Name" elseif [_CurrentField_]>= 180 && [_CurrentField_]< 275 then "Category Name" else "Category Name" endif

 

Hope that's help you 


astro90
5 - Atom

Thank you so much!!! 

Labels