Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Check out our powerful new search update! You can read more here. Please let us know if you have any feedback by creating a topic here.
SOLVED

Mathematical( division and multiplication) function with in IF statement

Highlighted
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. 

Highlighted
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))))

Highlighted
Quasar
Quasar

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

Highlighted
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" 

Highlighted
Quasar
Quasar

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).

Highlighted
Meteor

Untitled picture.png

Highlighted
Meteor

I CHANGED TO DOUBLE STILL GETTING AN ERROR

Highlighted
Quasar
Quasar

Could you send some sample data?

Highlighted
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