Alteryx Designer Desktop Discussions

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

RegEx: Separating Numerical and Non-Numerical Data within a Field

ALT_2358
9 - Comet

Hi,

 

I need to be able to separate numerical and non-numerical data contained within a field. 

 

I found a RegEx formula on here that someone else posted but it doesn't seem to work for negative numbers - otherwise it works well. Maybe it just needs to be tweaked a little. 

 

Here's what I have at the moment:

 

 

if 

IsNull([Value]) or IsEmpty([Value]) 
then "Numerical" 

ELSEIF

REGEX_Match([Value], '\d*\.{0,1}\d+') = 0 
then "Non-numerical" 

else "Numerical" endif

 

 

Just as an example, this is what I need:

 

Data [vwstring]Numerical?
215Numerical
-215Numerical
TextNon-Numerical
-0.256Numerical
55%Numerical
0Numerical
[NULL]

Numerical

45,253

Numerical

Text

Non-Numerical

Jan 2020

Non-Numerical

1,253,248.68

Numerical

 

I'm pulling data from several Excel files and it may have different types of formatting applied as per the above. It doesn't require any sort of formatting once brought into Alteryx, it just needs to be separated as numerical and non-numerical.

 

Any help would be much appreciated!

2 REPLIES 2
Greg_Murray
12 - Quasar

Try this one. It looks for values containing text instead of numerical values.It marks anything with alpha characters as non-numeric.

 

 

if 

IsNull([Value]) or IsEmpty([Value]) 
then "Numerical" 

ELSEIF

REGEX_Match([Value], '.*[a-zA-Z]+.*') 
then "Non-numerical" 

else "Numerical" endif

 

 

ALT_2358
9 - Comet

Worked perfectly - thank you!

Labels