Created
March 1, 2016 20:51
-
-
Save isleshocky77/6c9bbb58ab43717368c3 to your computer and use it in GitHub Desktop.
awk function for converting number to an alphabetic column
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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