In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Formula Issues

Riot
8 - Asteroid

I have time variable. It goes from 0-23. I want to parse it into categories. If 22,23, 0, 1,2 ,3 than 1, If 4,5,6,7,8,9 than 2, if 10,11,12,13,14,15 than 3 if 16,17,18,19,20,21 than 4. 

I have trouble writing forumlas with multiple posible outputs. Any advice would be great. 

2 REPLIES 2
danielbrun2
ACE Emeritus
ACE Emeritus

Hi,

The formula should look something like this:

 

IF [variable] IN (22,23,0,1,2,3) THEN 1
ELSEIF [variable] IN (4,5,6,7,8,9) THEN 2
ELSEIF [variable] IN (10,11,12,13,14,15) THEN 3
ELSEIF [variable] IN (16,17,18,19,20,21) THEN 3
ELSE 0
ENDIF

 

I have also attached a example workflow.

 

Have a nice weekend,

Daniel

 

jdunkerley79
ACE Emeritus
ACE Emeritus

Can easily be done using the MOD and Floor function:

Floor(Mod([Hour]+2,24) / 6) + 1

Attached as a workflow as well

Labels
Top Solution Authors