How to convert column letter to number

This post will guide you how to convert a column letter to a column number using an excel formula. And how to write a user defined function to convert column letter to number in excel VBA.

Convert column letter to number using excel Formula

If you want to convert a column letter to number, you can use a combination of the COLUMN function and the INDIRECT function to create an excel formula.

Firstly, you need to construct a text string of cell reference, such as: B1, then you can use INDIRECT function to transform this text string to a normal cell reference, next, using the COLUMN function to get the column number. So you can write down the following formula:

=COLUMN(INDIRECT(B1 &”1″))

Let’s see how this formula works:

=B1&”1″

convert column letter to column1

This formula will join a column number with “1” to construct as a new text string contains column letter. The returned value goes into the INDIRECT function as its argument.

 

=INDIRECT(B1 &”1″)

The INDIRECT function returns a valid cell reference from a text string returned by the above formula. Then the returned result is passed into the COLUMN function.

 

=COLUMN(INDIRECT(B1 &”1″))

convert column letter to column2

This formula returns the column number for a cell reference that returned by the INDIRECT function. So it returns number 1.

Convert column number to letter with VBA user defined function

You can also create a new user defined function to convert column number to a column letter in Excel VBA:

1# click on “Visual Basic” command under DEVELOPER Tab.

Get the position of the nth using excel vba1

2# then the “Visual Basic Editor” window will appear.

3# click “Insert” ->”Module” to create a new module named

convert column number to letter3

4# paste the below VBA code into the code window. Then clicking “Save” button.

Public Function ConLetterToNum(ColN)
   ConLetterToNum = Range(ColN & 1).Column
End Function

convert column letter to column3

 

5# back to the current worksheet, then enter the below formula in Cell C1:

= ConLetterToNum (B1)

convert column letter to column4


Related Formulas

  • Extract text after first comma or space
    If you want to get substring after the first comma character from a text string in Cell B1, then you can create a formula based on the MID function and FIND function or SEARCH function ….
  • Convert column number to letter
    If you want to convert column number to letter, you can use the ADDRESS function to get the absolute reference of one excel cell that contains that column number….

Related Functions

  • Excel COLUMN function
    The Excel COLUMN function returns the first column number of the given cell reference.The syntax of the COLUMN function is as below:=COLUMN ([reference])….
  • Excel INDIRECT function
    The Excel INDIRECT function returns the cell reference based on a text string, such as: type the text string “A2” in B1 cell, it just a text string, so you can use INDIRECT function to convert text string as cell reference….
Related Posts
How to Extract First Letter from Each Word in a Cell in Excel
extract first letter from word3

This post will guide you how to extract first letter from each word in a given cell in Excel. How do I extract the first letter of each word in a range of names in your current worksheet in Microsoft ...

How to ignore Blank Cells while Concatenating cells in Excel
concatenate cell but blanks3

This post will guide you how to concatenate cells but ignore all blank cells in your worksheet in Excel. How do I concatenate cells but ignore blank cells with a formula in Excel. How to create a concatenate formula to ...

How to Calculate the Average Excluding the Smallest & Highest Numbers in Excel
Calculate the Average Excluding the Smallest & Highest 10

Calculating the average for a batch of data is frequently used in our daily life. But for some cases like statistic the average score in a competition, or price analysis, we often calculate the average excluding the smallest and highest ...

How to Get the Maximum or Minimum Absolute Value in Excel
Get the Maximum or Minimum Absolute Value 10

It is easy to find the maximum or minimum value in a batch of data in excel, but if this batch of numbers contains both positive and negative numbers, the maximum or minimum absolute value cannot be found out by ...

How to Count Only Numbers in Bold in a Range of Cells in Excel
Count Only Numbers in Bold in a Range of Cells2

This post will guide you how to Count only numbers with bold style in a range of cells in Excel. How do I Count on cells with bold font within a range of cells using User defined function in Excel ...

How to Sum Only Numbers in Bold in a Range of Cells in Excel
Sum Only Numbers in Bold in a Range of Cells2

This post will guide you how to sum only numbers with bold style in a range of cells in Excel. How do I sum on cells with bold font within a range of cells using User defined function in Excel ...

How to Filter Formula in Excel
filter formula4

This post will guide you how to filter your data with an Formula in Excel. How do I filter cells with formulas through a User defined function in Excel 2013/2016. Filter Formula Assuming that you have a list of data ...

How to Count Cells by Font Color in Excel
count cells by font color2

This post will guide you how to count cells by font color in Excel. How do I Count the number of cells with specific cell Font color by using a User Defined function in Excel. Count Cells by Font Color ...

How to Highlight Cells Containing Formulas in Excel
highlight cells contain formula7

This post will guide you how to highlight cells in which contain formulas using Conditional Formatting feature in Excel. How do I conditionally format a cell if it contains formula using a User defined function in combination with Conditional Formatting ...

How to Extract Number from Text String in Excel
extract number from text string3

This post will guide you how to extract number from a given test string in Excel. How do I extract all numbers from string using a formula in Excel. How to get all number from a given test string using ...

Sidebar