alteryx Community

# Alteryx Designer Desktop Discussions

SOLVED

## IF A and B are null

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
16 - Nebula

Hi ew87,

This might be what you want,

wf

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

16 - Nebula

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

wf

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