Alteryx Designer Desktop Discussions

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

Converting Number to Corresponding Alphabet Letter

zaslam
5 - Atom

I have come across many solutions on how to effectively convert a letter into its corresponding number......, but I am having a hard time figuring how to do the opposite. Attached is a simple workflow where my intent is to identify the next letter in the alphabet. I have converted the letter into its corresponding number and then +1. Now I am not sure how to then convert that number back to its corresponding letter of the alphabet. 

 

I also don't care about 'z' or 'Z' where the next corresponding letter is "a' or "A'. I have filtered those out and hard coded the value.

 

I'm hoping this is a simple request, but perhaps not a common one. Thanks in advance for anyone's help!  

4 REPLIES 4
jdunkerley79
ACE Emeritus
ACE Emeritus

Probably the most direct way is the CharFromInt and CharToInt functions. Something like:

 

CharFromInt(
Mod(CharToInt(Uppercase([Letter]))-64,26)+65
)

 

 

These functions will switch to and from the ASCII code (A=65, B=66,...) for the letter. 

 

Attached a quick sample

vizAlter
12 - Quasar

Hi @zaslam — Try this solution... it will give you an idea:

 

vizAlter_0-1601098315771.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.

atcodedog05
22 - Nova
22 - Nova

Hi @zaslam ,

 

Since it doesnt matter whether its lower or upper i have converted all to lower. And built the logic around it.

 

Use this in formula

 

IF CharToInt(LowerCase([Letter]))=122 THEN CharFromInt(97)

ELSE CharFromInt(CharToInt(LowerCase([Letter]))+1) ENDIF

 

atcodedog05_0-1601100445391.png

atcodedog05_1-1601100467049.png

 

Hope this helps : )

 

If this solves your task please mark the post as solution

zaslam
5 - Atom

Thanks! All of these solutions worked well, but varied in approaches. The key to all of these for me was effectively using the ChartoInt and then the CharFromInt functions. 

 

Thanks everyone!

Labels