Get Exact column value from an excel


I want to get the exact column value, say for example if I give 1 its A, if 5 its E and if 26 its Z but if I go for 27 the it should return AA, if 30 it should be AD. Can you help me with this?

1 Like


Hope the below expression would help you get the column name

For AA1, AA2, AA3,……

Same with a little change in expression

Convert.ToChar( (65 + dt.Columns.IndexOf("Columnname") ) - 26).ToString + (dt.Rows.IndexOf(CurrentRow)+2).ToString

(Output will be “AA1”, “AA2”,…. String type)

Refer this thread for complete details

Cheers @karthikeyan.srinivasan9

will return AA

1 Like