Excel Sheet Column Number Problem Statement

You are provided with a string STR representing a column title in an Excel Sheet. Your task is to determine the corresponding column number.

Example:

A typical example includes: A corresponds to 1, B to 2, C to 3, ..., Z to 26, AA to 27, and so on.

Input:

The first line of input contains a single integer T, representing the number of test cases or queries to be executed.
The subsequent T test cases follow.
The first and only line of each test case contains a string STR denoting the column title. It is guaranteed that all characters are uppercase English alphabets.

Output:

For each test case, output the corresponding Excel column number of STR.
The result of each query should be printed on a new line.

Constraints:

  • 1 ≤ T ≤ 50
  • 1 ≤ |STR| ≤ 12

Here, T denotes the number of test cases, and |STR| denotes the length of the string.

Time Limit : 1 sec

AnswerBot
4mo

Convert Excel sheet column title to corresponding column number.

  • Iterate through the characters in the string from right to left, starting with a result of 0.

  • For each character, calculate its value by ...read more

Help your peers!
Select
Add answer anonymously...
Lowe's Full Stack Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits