Excel Sheet Column Title - Problem

Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet.

For example:

  • A → 1
  • B → 2
  • C → 3
  • ...
  • Z → 26
  • AA → 27
  • AB → 28
  • ...

Input & Output

Example 1 — Single Letter
$ Input: columnNumber = 1
Output: "A"
💡 Note: The first column in Excel is labeled 'A'
Example 2 — Double Letter Start
$ Input: columnNumber = 28
Output: "AB"
💡 Note: After Z (26), comes AA (27), then AB (28)
Example 3 — Large Number
$ Input: columnNumber = 701
Output: "ZY"
💡 Note: 701 converts to ZY using base-26 conversion with adjustment

Constraints

  • 1 ≤ columnNumber ≤ 231 - 1

Visualization

Tap to expand
Excel Column Number to Title Conversion1262728701↓ Mathematical Conversion ↓AZAAABZYBase-26 system with 1-indexing: A=1, Z=26, AA=27, AB=28...
Understanding the Visualization
1
Input
Column number (integer)
2
Convert
Base-26 with 1-indexing adjustment
3
Output
Excel column title (string)
Key Takeaway
🎯 Key Insight: Excel uses a modified base-26 system where we subtract 1 before each division to handle 1-based indexing
Asked in
Microsoft 35 Google 25 Amazon 20 Apple 15
89.2K Views
Medium Frequency
~15 min Avg. Time
2.8K Likes
Ln 1, Col 1
Smart Actions
💡 Explanation
AI Ready
💡 Suggestion Tab to accept Esc to dismiss
// Output will appear here after running code
Code Editor Closed
Click the red button to reopen