In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

IF Statement in Formula Tool not showing the desired output

willd9
7 - Meteor

I have a column called source_title and I'm trying to run a simple IF statement on it to give a new value to empty fields. So the logic is, if the field is empty or "(blank)" then replace that field with "Unknown". My code is below:

 

if IsEmpty([Source_Title]) or [Source_Title] = "(blank)" then [Source_Title] = "Unknown" else [Source_Title] endif

 

The code outputs a 0 instead of "Unknown" for all of the empty fields, does anyone know why? The format of the field is V_String.

2 REPLIES 2
DataNath
17 - Castor
17 - Castor

Hey @willd9, I recently wrote a blog on common Formula errors, one of which is this exact scenario! See section 4 here: https://community.alteryx.com/t5/Engine-Works/Troubleshooting-Common-Formula-Expression-Errors/ba-p/...

 

Essentially, you'll just want to remove the [Source_Title] = from your current expression so it should be:

 

if IsEmpty([Source_Title]) or [Source_Title] = "(blank)" then "Unknown" else [Source_Title] endif
binu_acs
21 - Polaris

@willd9 Another way of using this formula with the Trim function 

 

IIF(IsEmpty(Trim([Source_Title])),’unknown’,[Source_Title])

Labels
Top Solution Authors