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

Multiple IF Conditions

bods
5 - Atom

Hi,

 

 I would appreciate some help. may I know the right formula if in excel the formula is the following ( =IF(H2<>"(blank)",H2,IF(F2<>"(blank)",F2,IF(G2<>"(blank)",IF(M2<>"(blank)",M2,"(blank)"),"(blank)"))) what should i use in alteryx?.

 

Thank you so much in advance.

4 REPLIES 4
Kenda
16 - Nebula
16 - Nebula

Hi @bods!

 

Try using the below expression in a Formula tool and see if that gets you what you're looking for. If not, please provide sample before and after data, and we can assist further.

iif([H]!="",[H],iif([F]!="",[F],iif([G]!="",[G],iif([M]!="",[M],""))))

 

Capture.PNG

 

 

NOTE: You could also change all of the [FieldName]!="" sections to !isempty[FieldName]. This would account for if the field is blank or null. That expression would look like this:

iif(!isempty([H]),[H],iif(!isempty([F]),[F],iif(!isempty([G]),[G],iif(!isempty([M]),[M],""))))
bods
5 - Atom

Its work. Thank you so much for helping me

MarqueeCrew
20 - Arcturus
20 - Arcturus

@bods,

 

I would like to add another solution possibility for your consideration.  While it is possible to "convert" the Excel code into an Alteryx formula, I find that the result is somewhat hard to read.  @Kenda provided you with a solution that obviously works.  Please take a look at this alternative formula:

 

IF 
	!IsEmpty([H]) THEN [H]	ELSEIF
	!IsEmpty([F]) THEN [F]	ELSEIF
	!IsEmpty([G]) THEN [G]	ELSE
	[M]
ENDIF

If I had to explain the code to my boss/Mom/child/anyone without an Excel background, I think that this formula would be less time consuming to explain.  In fact, you can comment the formula too and make it even easier.

 

IF 
	!IsEmpty([H]) THEN [H]	ELSEIF	//Take data from the first column
	!IsEmpty([F]) THEN [F]	ELSEIF	//Resort to the second column if 1 is empty
	!IsEmpty([G]) THEN [G]	ELSE	//Settle for the third column if 2 is empty
	[M]				//You're stuck with the 4th column now
ENDIF

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
bods
5 - Atom

Thank you Mark! I'll will try this too.

Labels