Parse Cell Location String into Row & Column

calendar_today Asked Apr 9, 2012
thumb_up 6 upvotes
history Updated April 16, 2026

Question posted 2012 · +5 upvotes

i have string col= "AB21" which is an excel cell location.

I would like to parse it as string column = "AB" & int row = 21;

How can i do that?

Accepted answer +6 upvotes

string col = "AB21";
int startIndex = col.IndexOfAny("0123456789".ToCharArray());
string column = col.Substring(0, startIndex);
int row = Int32.Parse(col.Substring(startIndex));

Of course, you should guarantee that input string will be in correct format.

Top excel Q&A (6)

+6 upvotes ranks this answer #141 out of 167 excel solutions on this site .