Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isleshocky77/6c9bbb58ab43717368c3 to your computer and use it in GitHub Desktop.
Save isleshocky77/6c9bbb58ab43717368c3 to your computer and use it in GitHub Desktop.
awk function for converting number to an alphabetic column
function convertNumberToAlphabeticColumn(columnNumber) {
dividend = int(columnNumber);
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
columnName = "";
while (dividend > 0)
{
mod = int( dividend ) % 26;
columnName = substr( alphabet, mod, 1 )columnName;
dividend = int( dividend - mod ) / 26 ;
}
return columnName;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment