Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

If Null formula

JingYih_Herbalife
8 - Asteroid

Would like to have a simple formula whereby if the column has a number, then the result would be "Y", otherwise it would stay as null or empty. 

 

JingYih_Herbalife_0-1683512327663.png

 

Please help. 

 

7 REPLIES 7
flying008
15 - Aurora

Hi, @JingYih_Herbalife 

 

You can try this formula:

IIF(ToNumber([Txt]), 'Y', [Txt])

 

ahsanaali
11 - Bolide

See if this works for you.

ahsanaali_0-1683517213956.png

 

ArnaldoSandoval
12 - Quasar

Hi @JingYih_Herbalife 

 

Be aware that ToNumber([txt]) returns NULL for values like 'AB12' and 'Y' when the value is '12AB'

 

I attaching my test workflow:

hth

Arnaldo

flying008
15 - Aurora

Hi, @ArnaldoSandoval 

 

Yep, you are right ! ToNumber() only for pre number.

binuacs
21 - Polaris

@JingYih_Herbalife Another option with Regex_Match function

binuacs_0-1683539416334.png

 

ArnaldoSandoval
12 - Quasar

@JingYih_Herbalife  @binuacs 

 

If the input data field contains leading or trailing spaces, the REGEX_Match() failed to identify ' 233' or '444 ' as numeric, perhaps a Trim() can handle that.

 

Arnaldo

RobertOdera
13 - Pulsar

Hi, @JingYih_Herbalife 

 

Consider this treatment.

 

IF IsEmpty(Trim(ToString([2020]))) THEN Null()

ELSE Trim(ToString([2020]))

ENDIF

 

IsEmpty evaluates for both nulls and blanks and you might set the outcome as Null() versus null or empty

 

I hope you find this helpful - Cheers!

Labels
Top Solution Authors