# Convert a number to its equivalent letter

**URL:** <https://forums.thehomestack.io/t/convert-a-number-to-its-equivalent-letter/317>\
**Category:** vb.Net\
**Created:** [October 12, 2008, 6:21pm UTC](https://forums.thehomestack.io/t/convert-a-number-to-its-equivalent-letter/317 "2008-10-12T18:21:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://forums.thehomestack.io/uploads/default/original/1X/161426793bc0d8bdf0d1a6692b3e44446861cc72.jpeg) [@system](https://forums.thehomestack.io/u/system)\
**Post date:** [October 12, 2008, 6:21pm UTC](https://forums.thehomestack.io/t/convert-a-number-to-its-equivalent-letter/317/1 "2008-10-12T18:21:59Z")

</div>

If you want to convert a number to its equivalent letter, for e.g. 5 to E, you can use two approaches.

1. Insert this code in a Module and use this function

```auto
'Author: Alan L. Lesmerises
'From: http://www.freevbcode.com/ShowCode.asp?ID=4303

Function ColumnLetter(ColumnNumber As Integer) As String
  If ColumnNumber > 26 Then

    ' 1st character: Subtract 1 to map the characters to 0-25,
    ' but you don't have to remap back to 1-26
    ' after the 'Int' operation since columns
    ' 1-26 have no prefix letter

    ' 2nd character: Subtract 1 to map the characters to 0-25,
    ' but then must remap back to 1-26 after
    ' the 'Mod' operation by adding 1 back in
    ' (included in the '65')

    ColumnLetter = Chr(Int((ColumnNumber - 1) / 26) + 64) & _
                   Chr(((ColumnNumber - 1) Mod 26) + 65)
  Else
    ' Columns A-Z
    ColumnLetter = Chr(ColumnNumber + 64)
  End If
End Function

```

e.g. “=Columnletter(5)” will return E and “= Columnletter(COLUMN())” will return letter depending on which column this formula is in.

1. Use this formula (Credit due) “=LEFT(ADDRESS(1,COLUMN(),4),1)”

These formulas can be useful with functions like INDIRECT and OFFSET.
