Alteryx Designer Desktop Discussions

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

Mid/find formula not operating as expected

kelseyfalls
6 - Meteoroid

Hello! I am trying to replicate the Mid/find formula combo in excel to parse through a text string 

 

 

Here's some example text, I want my new column to give me the 0301 from this text:

 

Total.0301 - Example Example

 

So I'm using the substring/findstring combo as such:

 

( Substring ( [ mydata ] , FINDSTRING ( "." , [mydata] ) + 1, 5 ) )

 

So I would expect this to look for the "." and pull the 5 characters after that.. but alteryx is just pulling the first 5 characters of my data instead. 

 

Any idea of what I'm doing wrong?

6 REPLIES 6
Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @kelseyfalls,

 

You could use the following formula: REGEX_Replace([Text], '.*?(\d+).*', '$1')

 

image.png

 

If this solves your issue please mark the answer as correct, if not let me know! I've attached my workflow for you to download if needed.

 

Regards,

Jonathan

JosephSerpis
17 - Castor
17 - Castor

Hi @kelseyfalls this is the syntax you would need if you were using Findstring and Substring "Substring([Text],FindString([Text], ".")+1,4)". 

Substring_05052020.JPG

kirans666
8 - Asteroid

I believe you have got the items in the find function reversed , the below should give you the desired results. 

 

(Substring([Field1] ,FINDSTRING ([Field1],".")+1, 5 ) )

kelseyfalls
6 - Meteoroid

Thank you! This worked beautifully!

kelseyfalls
6 - Meteoroid

So what if you also have data like this in your grouping?

 

Example2: Example_EU2.0130 - Example

 

I want a formula that will extract the 0130 from this one and the first example: Total.0301 - Example..

 

 

Is that possible? The first formula just extracted the 2 from my first example which isn't what I want, but these are sort of two different patterns so I'm not sure it can be done.. maybe there's a way to do an IF function afterwards to identify the ones that didn't work?

kirans666
8 - Asteroid

You can use this to get any numbers after the "." 

 

trim((Substring([Field1] ,FINDSTRING ([Field1],".")+1, 5 ) ))

 

 

Labels