Convert multiple letters to ASCII and back to letters

skittlz

New Member
Joined
Oct 26, 2012
Messages
15
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone,

I have a spreadsheet that manages revisions of different documents. I'm currently using this formula to convert letters to ASCII value:

=IFERROR(SUMPRODUCT(CODE(UPPER(MID(G2,ROW(INDIRECT("1:"&LEN(G2))),1)))),"")

1720455732563.png


I only want Capital letters, and this formula works. For A (or a), this formula gives me 65. For Z or z, i get 90. for AA, I get 130.

Problem: How do i convert 130 back to AA? My current formula is:

=IFERROR(CHAR(MAXIFS(Formulas!I:I,Formulas!A:A,'Training Matrix'!A7)),"")

For AA, I get a comma, for AB I get the "f" symbol, for AC i get 2 comas. Ideally, I need both formulas to work till ZZ.
1720455880720.png

Please help!
 
Last edited:
@felixstraube - you're right - AA is bigger than Z, AZ is smaller than BA, and so on. Your formula makes sense - you're putting the ascii values of 2 letters together. I modified it so it coverts everything to upper case:

=LET(d, A1, l, LEN(d), exp, SEQUENCE(,l,l-1,-1), s, SEQUENCE(,l), SUM(CODE(UPPER((MID(d, s,1))))*100^exp) )

@rlv01 - i'm trying to work out how to make your formula work for 2 characters - it only seems to work for 4!
 
Last edited:
Upvote 0

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
If you want to pursue the ASCII idea, then the formulas can be simplified to this.
Book1
ABCDE
1NameDocumentRevRev numericalReverse
2Bill Document11E69E
3Bill Document11F70F
4Bob Document10AA6565AA
5Bob Document10C67C
6Bob Document10Z90Z
7Bob Document10ZA9065ZA
8Joe Document12G71G
9Joe Document12H72H
Sheet5
Cell Formulas
RangeFormula
D2:D9D2=--CONCAT(CODE(MID(C2,SEQUENCE(LEN(C2)),1)))
E2:E9E2=CHAR(LEFT(D2,2))&IF(LEN(D2)=4,CHAR(RIGHT(D2,2)),"")
 
Upvote 0
If your Rev system follows the Excel column standard (A->Z,AA->AZ,BA->BZ, . . . , ZA->ZZ, AAA->AAZ, etc.), you can do something like this:

Book1
ABCDE
1NameDocumentRevRev numericalReverse
2Bill Document11E5E
3Bill Document11F6F
4Bob Document10AA27AA
5Bob Document10C3C
6Bob Document10Z26Z
7Bob Document10ZA677ZA
8Joe Document12G7G
9Joe Document12H8H
Sheet9
Cell Formulas
RangeFormula
D2:D9D2=COLUMN(INDIRECT(C2&1))
E2:E9E2=SUBSTITUTE(ADDRESS(1,D2,4),1,"")
 
Upvote 0
@rlv01 - i'm trying to work out how to make your formula work for 2 characters - it only seems to work for 4!

That is odd. I don't have an issue.

Book1
ABCDE
1NameDocumentRevRev numericalReverse
2Bill Document11E69E
3Bill Document11F70F
4Bob Document10AA6565AA
5Bob Document10C67C
6Bob Document10Z90Z
7Bob Document10ZA9065ZA
8Joe Document12G71G
9Joe Document12H72H
Sheet1
Cell Formulas
RangeFormula
D2:D9D2=IF(LEN(C2)>1,CODE(LEFT(C2,1)) & CODE(RIGHT(C2,1)),CODE(C2))
E2:E9E2=IF(LEN(D2)=4,CHAR(LEFT(D2,2)) & CHAR(RIGHT(D2,2)),CHAR(D2))
 
Upvote 0
In case you have long rev strings (more than 3 characters):

Book1
ABCDE
1NameDocumentRevRev numericalReverse
2Bill Document11EFZG69709071EFZG
3Bill Document11F70F
4Bob Document10AA6565AA
5Bob Document10C67C
6Bob Document10AAAB65656566AAAB
7Bob Document10AAAC65656567AAAC
8Joe Document12ZAAB90656566ZAAB
9Joe Document12AAXAAA656588656565AAXAAA
Sheet1
Cell Formulas
RangeFormula
D2:D9D2=LET(d, Sheet1!$C2, l, LEN(d), exp, SEQUENCE(,l,l-1,-1), s, SEQUENCE(,l), SUM(CODE(MID(d, s,1))*100^exp) )
E2:E9E2=LET(n, D2, l, LEN(n)/2, CONCAT(CHAR(MID(n, SEQUENCE(,l,1,2),2))) )
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top