static readonly string[] Columns = new[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "AA", "AB", "AC", "AD", "AE", "AF", "AG", "AH", "AI", "AJ", "AK", "AL", "AM", "AN", "AO", "AP", "AQ", "AR", "AS", "AT", "AU", "AV", "AW", "AX", "AY", "AZ", "BA", "BB", "BC", "BD", "BE", "BF", "BG", "BH" };

public static string IndexToColumn(int index)
{
if (index < 0)
throw new IndexOutOfRangeException("index must be a positive number");
return Columns[index];
}

Description

  1. The above coding used to change from 1,2,3,4 into A,B,C,D.
  2. This coding normally used in excel spreadsheet to identify column numbering.
  3. Method to used it, first copy this coding. Then call this public string with name “IndexToColumn”.

                                             

7 thoughts on “Convert Numbering to Alphabet

  1. I just want to say I am just new to blogging and really enjoyed this blog site. Almost certainly I’m want to bookmark your blog . You surely come with incredible posts. Kudos for sharing with us your web-site.

Leave a Reply