Using Power Query M language, how can I convert Excel style column letter into its corresponding column number?
Examples:
A=1
Z=26
AA=27
AZ=52
SZ=520
XFD=16384
I have a Power Query script that is reading the .xml inside Excel .xlsx files. It is returning the cells that contain color but the returned values are in the AZ123
format. I am able to separate the column from the row, but now I want to have the column converted to a number.
I already know how to convert the column letter to a number using a VBA function using ColumnNumber = Range(ColumnLetters & "1").Column
, but I want to have the processing done in Power Query.
Here (VBA) and here (C#, JS) are some algorithm examples in other languages but I don't know how to write that in M.
Bonus request: Can you write it as an M function so it's easily reusable?