> For the complete documentation index, see [llms.txt](https://ugopireddy.gitbook.io/leet-code-solutions/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ugopireddy.gitbook.io/leet-code-solutions/solutions_151_-_200/171-excel-sheet-column-number-easy.md).

# 171 Excel Sheet Column Number – Easy

### Problem:

Given a column title as appear in an Excel sheet, return its corresponding column number.

For example:

```
    A -> 1
    B -> 2
    C -> 3
    ...
    Z -> 26
    AA -> 27
    AB -> 28
```

### Thoughts:

This is like a base of 26 system problem. It’s similar but easier than the reverse.

Because no need to worry about minus one problem.

### Solutions:

```java
public class Solution {
    public int titleToNumber(String s) {
        int result = 0;
        for (int i = 0; i < s.length(); i ++) {
            int digit = s.charAt(i) - 'A' + 1;
            result = result * 26 + digit;
        }
        return result;
    }
}
```
