Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Parse alphabet from number

ArnabSengupta
8 - Asteroid

Hi All,

 

I have a string in which is is represented as 1A, 2B, 7D etc. I want to replace the alphabets with their numeric position (A with 1, B with 2, C with 3 etc) and with a dot (.) in between (1A= 1.1, 2B= 2.2, 7D=7.4 etc).

 

I have attached the sample dataset with sheet 2 as the desired output.

 

Help is much appreciated.

 

Thank you!

4 REPLIES 4
DavidP
17 - Castor
17 - Castor

Hi @ArnabSengupta 

 

You can do this 2 ways:

 

1. create a lookup table that has A=1, B=2, etc.

 

2. or you can use the ASCII values and subtract the ASCII values.

 

Below is a solution for option 2. You don't have to use regex, you can also split the data using Left() and Right() functions

 

DavidP_0-1597444854790.png

 

Evaldas1
5 - Atom

Very nice solution #2

ArnabSengupta
8 - Asteroid

Hi @DavidP

 

Solution 2 seems quiet right but when I have 2 digit number followed alphabet, it is parsing the digits too.

 

eg. 19A

DavidP
17 - Castor
17 - Castor

Hi @ArnabSengupta 

 

You can just change the regular expression in the Regex tool to

 

(\d+)([[:alpha:]])

 

Updated version attached.

Labels