# FindingMyName

## Using Letters as a Numbering System in Word

If you've ever used a spreadsheet, you'll know that, by convention (at least now) rows are numbered with Arabic numerals in base 10 and columns are “numbered” with letters. In fact, this is basically a base 26 system with a slight twist. Or is it?

Let's build this from the ground up. We're familiar with counting in base 10, starting with 0: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, etc. We could use any symbol we want in place of the digits themselves, though. Let's use A as 0, B as 1, C as, 2, etc., through J as 9. Counting (starting at 0) would proceed as follows: A, B, C, D, E, F, G, H, I, J, BA, BB, BC, BD, BE, BF, BG, BH, BI, BJ, CA, CB, CC, etc. Fine and dandy, but what happened to AA through AJ?, since A represents 0, they're not missing, but AA is 00, which is just A, and AB is 01, which is just 1, and so on. That's not how spreadsheets indicate their columns. Let's revise our assumptions such that A in the units place represents 0, but it represents a 1 in the 10s place. Our revised count: A, B, C, D, E, F, G, H, I, J, AA, AB, AC, AD, AE, AF, AG, AH, AI, AJ, BA, BB, BC, BD, BE, BF, BG, BH, BI, BJ, CA, CB, CC, etc. We've done it! Or have we? IA in this case is equivalent to 90. So what's the number after IJ (99)? Is it JA? Or AAA? What base are we in, after all?

Thinking about it as a base 26 system doesn't help, because it isn't really one. Here's another way to think about it: How many combinations of one letter in the English alphabet are there? 26. What number is column Z in Excel? 26. How about 2 letters? 676. What number is column ZZ in a spreadsheet? 702. Three letters? 17576. If there were to be a column ZZZ in a spreadsheet, what number would it be? 18278. These are just “stacked” on each other, so we have all 1-letter combinations, followed by all 2-letter combinations, followed by all 3-letter combinations.

How does this relate to Microsoft Word?

Well, if you tell Word to number a list using an “alphabetic” sequence, you'll get A–Z like you might expect. You'll even get AA as the next item in that sequence. But what comes after that? AB? Microsoft gave you Excel, so that might be what you expect, but you get BB instead, then CC, DD, EE, through ZZ, followed in turn by AAA. and AAA is equivalent in this case to just 79 rather than 703. So if you want Excel-style numbering in Word, you have to be clever. Or masochistic. Or both. Because here's what the “formula” looks like in Word:

{ QUOTE { SET FIRST { =INT({ SEQ ABC \c })/26 } }{SET SECOND { =MOD({SEQ ABC }-1,26)+1 } } { IF FIRST >= 1 { FIRST \*Alphabetic } }{ SECOND \*Alphabetic } }


This is a set of nested field codes, so the curly-braces ({ and }) are actually special characters, the pair of which is inserted with Ctrl+F9 (by default). I'm not providing the step-by-step, but what I've given along with some appropriate “Googling” should be enough to recreate it. This will number each consecutive instance of this set of field codes with the “next” appropriate number in the anticipated spreadsheet schema. It can be extended to a third character if you need 703 or more items, or a fourth if you need more than 18278, but I'm leaving those as exercises for the reader.

-JMC