Free Trial

Alteryx Designer Desktop Discussions

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

IF A and B are null

ew87
7 - Meteor

I know this is likely a simple solution that I'm just not thinking of, but I'm stuck. I have two columns, A and B. I'm creating a new column C that should work like this:

 

If column A is null, then use the value from column B. If column A AND B are both null, then input "N/A". Otherwise, use the value from column A.

 

This is the formula that is not working:

if IsNull([ColumnA]) THEN [ColumnB] ELSEIF (IsNull([ColumnB]) AND IsNull([ColumnA])) THEN "N/A" ELSE [ColumnA] ENDIF

 

Appreciate any help to get this working!

4 REPLIES 4
PhilipMannering
16 - Nebula
16 - Nebula

Hi ew87,

 

This might be what you want,

 

 

wfwf

ashishkhurana
7 - Meteor

Order of your If statement is not correct. you should first check for null values in both A &B Columns. And in the next "if-else" statement, you should check if A is null and B is not null then column A else column A

 

Structure of IF-ELSE Statement:

IF A= Null() and B= Null() then "N/A"

elseif A=Null() and B!=Null() then [B]

else [A]

Endif

 

If my post helped you in solving your doubt then please give me a star to appreciate my time and efforts

PhilipMannering
16 - Nebula
16 - Nebula

If A and B are the same when populated you could also use,

 

wfwf

ew87
7 - Meteor

All of these methods worked - thank you! I knew it had to be something with the way I was formatting my IF statement. Great to learn the other ways to achieve the same results as well.

Labels
Top Solution Authors