Knowledge.ToString()

# Excel Column Letter to Number Quick Reference

Here is a quick reference for Excel column letter to number mapping. Many times I needed to find the column number associated with a column letter in order to use it in Excel Macro. For a lazy developer like me, It is very time consuming ðŸ˜‰ to use my Math skill to get the answer so I created this quick reference lookup for myself.

If you are looking for a specific column, click on the following links to jump to a specific list of columns

## Excel Columns ZA-ZZ

#### 30 responses to “Excel Column Letter to Number Quick Reference”

1. Eric Swartwout

call this function with letters to convert to number or numbers to convert to letters

Function letnum(Ref As Variant) As Variant
Dim up As String
Dim chr1 As String ‘first character
Dim chr2 As String ‘second character
Dim trips As Long ‘ trips through alphabet
Dim asc2 As Variant ‘second letter

‘check to see if parameter is letter or number
If IsNumeric(Ref) = False Then
trips = 0
up = UCase(Ref)
‘look for one or 2 characters
If Len(up) = 2 Then
chr1 = Left(up, 1)
chr2 = Right(up, 1)
trips = Asc(chr1) – 64
ElseIf Len(up) = 1 Then
chr2 = up
End If

If Asc(chr2) >= 65 And Asc(chr2) <= 90 Then
letnum = Asc(chr2) – 64 + (trips * 26)
End If

ElseIf IsNumeric(Ref) = True And Ref 26 Then
If Ref Mod 26 > 0 Then
asc2 = Chr((Ref Mod 26) + 64)
letnum = Chr((Ref \ 26) + 64) & asc2
Else
asc2 = Chr(90)
letnum = Chr((Ref \ 26) + 63) & asc2
End If
Else
letnum = Chr(Ref + 64)
End If

Else
letnum = “error”
End If

End Function

2. Yolanda Basson

How do I change the column names back to letters instead of numbers?

1 2 3 4 5
2
3
4
5

But want it to be

A B C D E
1
2
3
4
5

1. Vishal Monpara

Hi Yolanda,

You may have R1C1 Reference style enabled. That is the reason, it is showing all numbers. In order to change it, go to File menu > Options > Formulas tab > under “Working with Formulas” section, you will see “R1C1 Reference style” checked. Uncheck this box and you will get all your columns in alphabets.

Regards
Vishal Monpara

3. Thomas

Still the most useful reference, since manually computing it takes much longer. ðŸ™‚

4. Gilberto

Thank you!!

5. holibut

You can change column name to number by programming. The following is in Python:

“`
def getExcelColumnNumber(columnName):
# columnName as A, AA, ABC
columnLetters = list(columnName)
print(columnLetters)

columnValue = 0
lettersCount = len(columnLetters)
for i in range(lettersCount):
columnValue = columnValue + 26**(lettersCount -i-1) * (ord(columnLetters[i]) – 64)
# end for

return columnValue
# end def

# test

getExcelColumnNumber(‘AA’) # 27
getExcelColumnNumber(‘YA’) # 651
getExcelColumnNumber(‘ZZ’) # 702
“`

6. Scott

Thanks from New Zealand. ðŸ™‚

Thanks! What a timesaver. Just found this for the first after manually calculating the column numbers for VLOOKUP function.

8. Dee Roche

=column() in a column will render the column number

9. Mateja

or you can just make a simple script that takes an input (such as ABD, ABCDEFG, etc) and returns the #

s, o, l = input(), 0, list(‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’)

for i in range(len(s)):
o*=26
o+=l.index(s[i])+1

print(o)

10. Yoyo At The Beach

Thanks from the Cayman Islands for this!
You saved me a lot of time working on my vlookups âœŒâœŒâœŒ

11. Jonathan

Thank you for this! I’ve visited this page many times when working on VLOOKUPs. Total life saver.

12. Jameel Siddiq

brilliant job, I often need the reverse but your table gives me that option as I can just look up the other way

13. Dirk

Thank you, such a simple table but very, very helpful.

14. Stephen Allen

I agree that this is really useful. I have take the opportunity to extend the process to Column XFD – the last in my version of Excel.

A copy of the VB Code is available at https://www.linkedin.com/feed/update/urn:li:activity:6644160098514141186

15. Courtney

Thank you so much! This is so helpful ðŸ™‚

16. Oj Shrivastava

Or you can just make quick Mathematical formula based on the position of input.
eg.
ABC: 26*26*(A=1) + 26*(B=2) + (C=3) = 731.
CH: 26*(C=3) + (H=8) = 86.

1. VIPUL JHAVERI

very brilliant
thanks to share
vipul jhaveri

17. Martin

you should stop using vlookup and use xlookup. There you can just reference “CH” instead of 86

18. Tim

Thank you! I ran out of fingers trying to figure out how to reference Column CH in my VLOOKUP. ðŸ™‚
So simple and yet so useful–bless you, Mr. Monpara!

19. Vipul

Thank you. what a time saver

20. Nick

Thanks, it helped!

22. Ravinga

23. leonora

fabulous a real time saver thankyou!

24. Andrew Harichandran

Thank you, Mr. Vishal Monpara!

25. Natasha

Thank you so much for this. It’s such a simple thing, but it’s so very helpful.

26. Chris

Thank you that’s very useful. I use this list everyday at work.

27. Katie

Thank you! The formulas elsewhere online (eg “=COLUMN(INDIRECT(B5&”1″))”) work just fine, but imo it’s a bit more efficient to just use a list sometimes.

28. Abhilash Nagkat

Can you also provide the Column# for column till AAA or so?