Given a spreadsheet column title as it appears in a spreadsheet application (for example "A", "Z", "AA"), return its corresponding column number. Columns are numbered in a base-26 system where "A" is 1, "B" is 2, ..., "Z" is 26, "AA" is 27, and so on. The input contains only uppercase letters A-Z.
Examples:
Input: columnTitle = 'A'
Output: 1
Explanation: The first column is number 1
Input: columnTitle = 'Z'
Output: 26
Explanation: The 26th and last single-letter column
Input: columnTitle = 'AA'
Output: 27
Explanation: After Z (26) comes AA (27)
Input: columnTitle = 'AB'
Output: 28
Explanation: AA is 27, so AB is 28
Input: columnTitle = 'ZY'
Output: 701
Explanation: 26 * 26 + 25 = 701
Apex Code Editor
Welcome to Lightning Challenge!
How It Works
- • Write your solution in the code editor
- • Connect your Salesforce org to test
- • Submit to check if your solution passes
- • Use hints if you get stuck
Contest Alert
🏆 #CodeEveryDay November 2026 (Nov 1–15)Sponsored by FLXBL
Contest runs November 1 - 15. Complete challenges to climb the leaderboard!
Prizes 1 & 2: Salesforce certification exam voucher — won by random drawing, where every point is a ticket. see all prizes
Only the 15 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.