cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-227514%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EConversion%20de%20l'alphabet%20en%20chiffres%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-227514%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EJ'ai%20une%20colonne%20qui%20contient%20des%20valeurs%20comme%20MN%20%2C%20YZ%20etc.%3C%2FP%3E%3CP%3EJe%20dois%20supprimer%20l'espace%20entre%20les%20deux%2C%20%C3%A9changer%20les%20caract%C3%A8res%20et%20convertir%20le%20dernier%20alphabet%20en%20chiffre.%3C%2FP%3E%3CP%3ECela%20signifie%20-%3C%2FP%3E%3CP%3Eentr%C3%A9e%20%3A%20MN%3C%2FP%3E%3CP%3Esortie%20%3A%20N13%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EComment%20puis-je%20faire%20ceci%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-227553%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%20%3A%20Conversion%20de%20l'alphabet%20en%20chiffres%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-227553%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3Ev%C3%A9rifiez%20si%20vous%20n'avez%20qu'un%20seul%20mot%20et%20si%20c'est%20le%20cas%2C%20modifiez%20la%20r%C3%A9ponse%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Eif(word(2%2C%20%3AColumn%201%2C%20%22%20%22)%20%3D%3D%20%22%22%2C%0A%20%20%20%20%20do%20what%20you%20want%20if%20only%20one%20letter%2C%0A%20%20%20%20Word(%201%2C%20%3AColumn%201%2C%20%22%20%22%20)%20%7C%7C%20Char(%0A%20Hex%20To%20Number(%20Hex(%20Word(%202%2C%20%3AColumn%201%2C%20%22%20%22%20)%20)%20)%20-%2064%0A%20%20%20%20)%0A)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-227550%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%20%3A%20Conversion%20de%20l'alphabet%20en%20chiffres%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-227550%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EMerci%20pour%20la%20r%C3%A9ponse.%20Pour%20MN%20%2C%20le%20r%C3%A9sultat%20attendu%20est%20N13.%20J'ai%20pu%20modifier%20la%20fonction%20Word%20et%20faire%20fonctionner%20cela.%20Il%20peut%20y%20avoir%20des%20cas%20o%C3%B9%20la%20colonne%201%20n'a%20qu'un%20seul%20alphabet%20comme%20%22A%22.%20Dans%20ce%20cas%2C%20je%20dois%20imprimer%20A0%20dans%20la%20colonne%202.%20Comment%20puis-je%20%C3%A9tendre%20le%20code%20pour%20ce%20faire%26nbsp%3B%3F%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-227547%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%20%3A%20Conversion%20de%20l'alphabet%20en%20chiffres%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-227547%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ESalut%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEssayez%20la%20formule%20suivante%20(copiez-collez%20dans%20l'%C3%A9diteur%20de%20formule)%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EWord(%201%2C%20%3AColumn%201%2C%20%22%20%22%20)%20%7C%7C%20Char(%0A%20Hex%20To%20Number(%20Hex(%20Word(%202%2C%20%3AColumn%201%2C%20%22%20%22%20)%20)%20)%20-%2064%0A)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EVoici%20un%20aper%C3%A7u%20de%20ce%20%C3%A0%20quoi%20ressemblera%20le%20tableau%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22SIMPLE%20TABLE.PNG%22%20style%3D%22width%3A%20718px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22SIMPLE%20TABLE.PNG%22%20style%3D%22width%3A%20718px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22SIMPLE%20TABLE.PNG%22%20style%3D%22width%3A%20718px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F19498i366A8512D874001B%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22SIMPLE%20TABLE.PNG%22%20alt%3D%22SIMPLE%20TABLE.PNG%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-227527%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%20%3A%20Conversion%20de%20l'alphabet%20en%20chiffres%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-227527%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ECela%20fonctionnera%20pour%20votre%20cas%20affich%C3%A9...%20mais%20je%20ne%20sais%20pas%20s'il%20est%20suffisamment%20complet.%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Ealphabet%3D%22ABCDEFGHIJKLMNOPQRSTUVWXYZ%22%3B%0Aword(2%2C%3Atargetvariable%2C%22%20%22)%20%7C%7C%20Char(%20contains(%20alphabet%2C%20word(1%2C%3Atargetvariable%2C%22%20%22)))%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EIl%20s'agit%20d'une%20formule%20qui%20peut%20%C3%AAtre%20utilis%C3%A9e%20pour%20une%20formule%20pour%20une%20nouvelle%20colonne.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
ENTHU
Level IV

Converting alphabet to digits

I have a column that contains vaalues like M N , Y Z etc.

I need to remove the space in between,swap the characters and convert last alphabet to digit.

That means -

input : M N

output : N13

 

How can I do this?

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Converting alphabet to digits

check to see if you only have 1 word and if so, then change the response

if(word(2, :Column 1, " ") == "",
     do what you want if only one letter,
    Word( 1, :Column 1, " " ) || Char(
	Hex To Number( Hex( Word( 2, :Column 1, " " ) ) ) - 64
    )
)
Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: Converting alphabet to digits

This will work for your displayed case....but I don't know if it is complete enough.

alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
word(2,:targetvariable," ") || Char( contains( alphabet, word(1,:targetvariable," ")))

  This is a formula that can be used for a formula for a new column. 

Jim
Thierry_S
Super User

Re: Converting alphabet to digits

Hi, 

 

Try the following Formula (copy - paste in the Formula Editor)

Word( 1, :Column 1, " " ) || Char(
	Hex To Number( Hex( Word( 2, :Column 1, " " ) ) ) - 64
)

Here is a snapshot of what the table will look like 

SIMPLE TABLE.PNG

Thierry R. Sornasse
ENTHU
Level IV

Re: Converting alphabet to digits

Thanks for the response.For M N , the expected output is N13. I was able to change the Word function and get this working. There can be cases when column 1 has only one alphabet like "A". In this case i need to print A0 in column 2. How can I extend the code to do this?
txnelson
Super User

Re: Converting alphabet to digits

check to see if you only have 1 word and if so, then change the response

if(word(2, :Column 1, " ") == "",
     do what you want if only one letter,
    Word( 1, :Column 1, " " ) || Char(
	Hex To Number( Hex( Word( 2, :Column 1, " " ) ) ) - 64
    )
)
Jim

Recommended Articles