cancel
Showing results for
Did you mean:

# Alteryx designer Discussions

SOLVED

## IF A and B are null

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!

Alteryx Certified Partner

Hi ew87,

This might be what you want,

wf

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

Alteryx Certified Partner

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

wf

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