Create Alphabet Codes, Number Codes, and Scrambled Words in Excel
Question details
Create formulas that transform a word into a backward alphabet code, an alphabet-position number code, and a randomly scrambled word.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The user wants to generate simple word-based coding activities for children from a word entered in a worksheet cell.
- Observed behavior
- The worksheet should process the word in A1 and return a shifted-letter code, a numeric alphabet code, and a randomized arrangement of its letters.
Enter one word in cell A1, preferably without spaces or punctuation. The dynamic-array formulas below require a current version of Excel or a spreadsheet application that supports TEXTJOIN, SEQUENCE, SORTBY, and RANDARRAY.
Use dynamic-array formulas to create all three word codes
Use this method when you have a current version of Excel and want each code to update automatically whenever the word in A1 changes.
This setup uses an alphabet lookup table for the backward letter shift. The number code uses each letter's position in the English alphabet, while the scramble formula assigns random values and sorts the letters by those values.
In H1:H26, enter the letters A through Z. In I1:I26, enter the matching backward-shift letters Z, A, B, C through Y. This makes A return Z, B return A, and so on.
Select C1 and enter: =TEXTJOIN("",TRUE,XLOOKUP(MID(UPPER(A1),SEQUENCE(LEN(A1)),1),$H$1:$H$26,$I$1:$I$26,MID(UPPER(A1),SEQUENCE(LEN(A1)),1))). Press Enter to shift each recognized letter one position backward.
Select D1 and enter: =TEXTJOIN("-",TRUE,XMATCH(MID(UPPER(A1),SEQUENCE(LEN(A1)),1),$H$1:$H$26)). Press Enter to return values such as 3-1-20 for CAT.
Select E1 and enter: =TEXTJOIN("",TRUE,SORTBY(MID(A1,SEQUENCE(LEN(A1)),1),RANDARRAY(LEN(A1)))). Press Enter to shuffle the letters. Press F9 to recalculate and generate another scramble.

Build the codes with helper columns when dynamic formulas are unavailable
Use this method if your Excel version does not include SEQUENCE, SORTBY, RANDARRAY, or XLOOKUP.
Generate alphabet and scrambled-word codes in WPS Spreadsheet
WPS Spreadsheet can create letter-shift codes, alphabet-position number codes, and randomized word activities with familiar Excel-style formulas. Enter a word once, apply the formulas, and refresh the sheet whenever you need a new scramble.
- 1. Open WPS Spreadsheet: Launch WPS Office, choose Spreadsheets, and create a blank workbook.
- 2. Enter the source word: Type the word to be coded in cell A1.
- 3. Add an A-to-Z lookup table: Enter A through Z in one column and the backward-shift letters in the next column for use with lookup formulas.
- 4. Apply code formulas: Enter the letter-shift, number-code, and scramble formulas in separate output cells such as C1, D1, and E1.
- 5. Recalculate for another scramble: Press F9 or edit the worksheet to refresh RANDARRAY-based scrambled results.

Frequently Asked Questions
How do I shift each letter backward by one in Excel?
Create a lookup table with A through Z in one column and Z through Y in the next column, then use XLOOKUP to return the matching shifted letter for every character in the word.
How can I convert a word into alphabet-position numbers?
Use XMATCH or MATCH against a list of A through Z. For example, C returns 3, A returns 1, and T returns 20; TEXTJOIN can combine the results with hyphens.
Why does my scrambled word keep changing?
A scramble formula that uses RANDARRAY recalculates whenever the workbook recalculates. To keep a particular scramble, copy the result and choose Paste Special > Values.
Can these formulas handle lowercase words?
Yes. Wrap the input in UPPER(A1), or apply UPPER to each extracted character, so the lookup table consistently matches uppercase A-to-Z values.
What should I use if my Excel version does not support SEQUENCE or XLOOKUP?
Use helper columns. Extract characters with MID, use VLOOKUP or MATCH against an A-to-Z table, generate random values with RAND, and sort the letters by the random-number column.




