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

IF formula when column A is Blank, populate with Column B, update column B With blank

Masond3
8 - Asteroid

Hi All, 

 

I have such a basic ask, but i am struggling to write the correct formula. 

 

I have two columns, i am trying to write a simple formula that does the following ; 

 

if column A is "blank" & column B is "not blank", then populate  Column A with  column B 

Then Remove value from Column B

 

Input 

 

Column A Column B
 123 High Street

 

Expected Outcome 

 

Column A Column B
 123 High Street 

 

 

I have used the  following formula ;

 

If isnull([Column A]) then [Column B] else [Column A] endif

 

Current output 

 

Column A Column B
123 High Street123 High Street

 

7 REPLIES 7
DataNath
17 - Castor
17 - Castor

Hey @Masond3, you can just add a second expression like so that will empty out (null) the second column. Input:

 

DataNath_0-1677504445861.png

 

Output:

 

DataNath_1-1677504457112.png

Masond3
8 - Asteroid

@DataNath  That would populate for anything in column B, is there a way it can only populate for those records in expression 1 ?

binuacs
21 - Polaris

@Masond3 One way of doing this by assigning the value of B to a temporary variable

binuacs_0-1677505615804.png

 

Christina_H
14 - Magnetar

Simplest way would be to clear column B if it's the same as column A after the first formula.

IF [Column B]=[Column A] THEN Null() ELSE [Column B] ENDIF

Masond3
8 - Asteroid

Hi @Christina_H  - that makes sense :)

Daft question, if i want to apply the formula to only work in  x circumstances ( how do i apply more logic) 
example 
 if column c = New york, 

and  column A is "blank" & column B is "not blank", then populate  Column A with  column B 

Then Remove value from Column B

Christina_H
14 - Magnetar

You can use AND / OR in formulas to extend the logic.  An exclamation mark can be used for NOT.

 

IF [Column C]="New York" AND IsEmpty([Column A]) AND !IsEmpty([Column B]) THEN [Column B] ELSE [Column A] ENDIF

Masond3
8 - Asteroid

@Christina_H  Super Star ! hopefully this help me some of the issues i am encountering :) 

Labels