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 Regular Expression: find specific digits and return a value

jf97hernandez
7 - Meteor

Dear all,

 

I am trying to use a formula tool with a RegEx to return a value based on part of a text. More specifically, if the text is 1-187698, the return should be "One"; and if the text is 09-567-09870, the return should be "Two". So pretty much I am trying to look how many digits before the first dash, and based on that condition it returns the corresponding value.

I tried using an IF Left formula to no avail, and also using a regular expression tool to no avail.

 

CriteriaSolution
1-187698One
09-567-09870Two
9-925612One
15-981-16578Two
99-909-12986Two

 

Thank you in advance for your time and assistance, and I wish you all a great weekend.

 

Best,

Jf97hernandez

1 REPLY 1
AngelosPachis
16 - Nebula

Hi @jf97hernandez ,

 

You can make use of the findstring embedded formula in the formula tool

 

AngelosPachis_0-1611350360267.png

 

Have a good weekend 

 

Regards,

 

Angelos

Labels