Created
November 25, 2014 20:27
-
-
Save mikofski/bcd1ccf813f1088cfcd9 to your computer and use it in GitHub Desktop.
convert MS Excel row-column reference to A1 reference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [a1,aa] = rc2a1(row,col) | |
% RC2A1 convert row, column reference to A1 reference for excel | |
% A1 = RC2A1(ROW,COL) returns the equivalent reference as a string | |
% for the given row, ROW, and column, COL, numbers. | |
a1 = char(64+mod(col-1,26)+1); | |
xcol = ceil(col/26)-1; | |
if xcol>0 | |
[~,aa] = rc2a1(row,xcol); | |
a1 = [aa,a1]; | |
end | |
aa = a1; | |
a1 = [a1,int2str(row)]; | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment