Find Excel column number from column title | C # program to return title to result of excel sheet . ; Returns resul when we pass title . ; This process is similar to binary - to - decimal conversion ; Driver Code
using System ; class GFG { public static int titleToNumber ( string s ) { int result = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { result *= 26 ; result += s [ i ] - ' A ' + 1 ; } return result ; } public static void Main ( string [ ] args ) { Console . Write ( titleToNumber ( " CDA " ) ) ; } }