Convert index to Excel A1 notation
Version 1.0.0.0 (1.14 KB) by
Matt Brunner
Convert index to Excel A1 notation used in xlswrite
This function translates an index to the Excel A1 notation that is used in xlswrite.
%%%
function a1String = idx2A1(idx)
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
if idx < 27
a1String = alphabet(idx);
else
idx2 = rem(idx,26);
if idx2 == 0
a1String = [alphabet(floor(idx/26)-1),'Z'];
else
a1String = [alphabet(floor(idx/26)),alphabet(idx2)];
end
end
%%%
Cite As
Matt Brunner (2026). Convert index to Excel A1 notation (https://www.mathworks.com/matlabcentral/fileexchange/28794-convert-index-to-excel-a1-notation), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2007b
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
Find more on Spreadsheets in Help Center and MATLAB Answers
Tags
Acknowledgements
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
