Function to convert column number to letter?

后端 未结 28 2034
灰色年华
灰色年华 2020-11-22 07:04

Does anyone have an Excel VBA function which can return the column letter(s) from a number?

For example, entering 100 should return CV.

28条回答
  •  生来不讨喜
    2020-11-22 07:30

    This formula will give the column based on a range (i.e., A1), where range is a single cell. If a multi-cell range is given it will return the top-left cell. Note, both cell references must be the same:

    MID(CELL("address",A1),2,SEARCH("$",CELL("address",A1),2)-2)

    How it works:

    CELL("property","range") returns a specific value of the range depending on the property used. In this case the cell address. The address property returns a value $[col]$[row], i.e. A1 -> $A$1. The MID function parses out the column value between the $ symbols.

提交回复
热议问题