Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Mathematical( division and multiplication) function with in IF statement

draghava
7 - Meteor

I want to create the new column  based on two columns for example , I have column called code "6002" which needs to divide the " Amount column " to split 50/50 else it should repeat the same amount from " Amount column" . please help. 

8 REPLIES 8
draghava
7 - Meteor

BELOW IS THE EXCEL FUNCTION TRYING TO DO IN ALTERYX

 

=IF(F8=6001,H8/2,IF(F8=6009,H8/2,IF(F8=6010,H8/2,IF(F8=6022,H8/2,H8))))

Ladarthure
14 - Magnetar
14 - Magnetar

Hi, could you please post some sample data, if it's in line 8 of your excel file, I would do an alteryx formula like this one:

 

if [Code] = 6001 then then [Amount]/2

elseif [Code] = 6009 then then [Amount]/2

...

else [Amount] endif

 

or a formula like this one

if [Code] in ('6001', '6009'...) then [Amount]/2

else [Amount] endif

draghava
7 - Meteor

I TRIED with below function, 

 

IF [TAX CODE] in (6001, 6009,6010,6022) then [Final Amount ]/2

else [Final Amount ] endif 

 

but its shows  error "tried to apply numeric operator to string value" 

Ladarthure
14 - Magnetar
14 - Magnetar

To use in I think you have to use " or ' and the tax code must be in a string format (use a select tool before your formula to do so).

draghava
7 - Meteor

Untitled picture.png

draghava
7 - Meteor

I CHANGED TO DOUBLE STILL GETTING AN ERROR

Ladarthure
14 - Magnetar
14 - Magnetar

Could you send some sample data?

draghava
7 - Meteor

Thanks I have corrected . The error I done the " Final amount "column was in string I change to " double " and then it works out .

Labels