Alteryx Designer Desktop Discussions

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

How to do mid formula

jenner85
8 - Asteroid

Hi - I am trying to get the MC out of a field under the condition that the field has the word "CODE" in it. I am trying to use the substring formula but it's not giving me what I want. 

 

OD CODE: MC C 

 

 

this is what I am attempting to use:

 

If Contains([Daily Count],"CODE")
then
Substring([Daily Count],8,9)
else
Null()
endif

2 REPLIES 2
Emil_Kos
17 - Castor
17 - Castor

Hi @jenner85,

 

If you want to receive only MC the formula should look like this:

 

If Contains([Daily Count],"CODE")
then
Substring([Daily Count],9,2)
else
Null()
endif

vizAlter
12 - Quasar

Hi @jenner85 — Also, try this solution... the same results you can achieve using RegEx expression:

 

//Method- if "MC" or anything else is available upto 2 length
If Contains([Daily Count],"CODE") Then
 REGEX_Replace([Daily Count], ".*:\s(..).*", "$1") 
Else
 Null() 
endif

 

 

vizAlter_2-1600875235236.png

 

 

 

If it resolves your query please mark it "Solved" or "Solved" with a Like. This will help other users find the same answer/resolution.  Thank you.

Labels