function excelInd(title) { title = title.toUpperCase(); let up = "A".charCodeAt(0) - 1, index = 0; for(letter of title) { index *= 26; index += letter.charCodeAt(0) - up } return --index } alert(excelInd('aa'))