View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Convert an A1-style spreadsheet column label to a number.

  • abc2num(S)ABC2NUM convert a spreadsheet label string to corresponding column number.
  • num2abc(D)NUM2ABC returns spreadsheet string equivalent to the specified integer.
  • View all files
5.0 | 1 rating Rate this file 3 Downloads (last 30 days) File Size: 2.35 KB File ID: #14008 Version: 1.12
image thumbnail

Convert an A1-style spreadsheet column label to a number.


DS (view profile)


19 Feb 2007 (Updated )

ABC2NUM translates an A1-style (absolute) column label reference to a number; NUM2ABC does inverse.

| Watch this File

File Information

ABC2NUM(S) returns the number corresponding to the spreadsheet column represented by the reference string, S. The input string, S, may contain the ascii letters A-Z, in the format commonly employed by spreadsheet programs such as Calc and Microsoft Excel[1]. Other characters, including lower case letters, a-z, are ignored.

NUM2ABC(D) returns the A1-style string label corresponding to the appropriate spreadsheet column represented by the specified integer, D. The specified integer must be greater than or equal to one.

[1] Abraham, R., Burnett, M. and Erwig, M., "Spreadsheet Programming" Encyclopedia of Computer Science and Engineering, (ed. B.J. Wah), 2804-2810, 2009
DOI: 10.1002/9780470050118.ecse415

Please note: There are many interesting submissions on FEX which provide similar results (see below).

#5942 - xlcolumn
#32843 - Excel column header
#30180 - Calculate Excel range
#28343 - Column Converter for Excel
#27182 - Excel Column Conversion
#15748 - Excel Column Number To Column Name
#12796 - excelcolumn
#6706 - Excel Named Ranges


Convert Decimal Integer To Arbitrary Base. inspired this file.

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
22 Jul 2013 yksiii

yksiii (view profile)

20 Jun 2007

Included acknowledgment of the complementary function NUM2ABC.

18 Feb 2012 1.1

fixed string output

21 Feb 2012 1.2

Extended translation to cover arbitrary number of digits; included complementary function num2abc.

21 Feb 2012 1.3


26 Feb 2012 1.9

Added ref info.

28 Feb 2012 1.10

Edited info text; no code changes.

17 Mar 2012 1.11

Edited info text; no code changes.

23 Mar 2012 1.12

Edited info text; no code changes.

Contact us