You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
This is basically a Matlab version of the Excel function Offset, albeit with enhancements.
xlrange = xlcalcrange(h,refCell,r,c,m,n)
returns the full target range in Excel A1 notation to cover an m-by-n array, starting from an offset of r rows & ccolumns from the starting cell, refCell.
Workbook and worksheet prefixes are removed from refcell, as are any absolute markers. Thus, $P6:AC$91becomes: P6:AC91
refcell can also be an Excel named range, but requires the Excel workbook to be open via an actxserver COM object, and a handle to the object, h, passed as a function argument. h is ignored if refcell is not a named range.
Note: this file makes use of 2 functions: dec2base27.m & base27dec.m that were sourced from inside of Mathwork's function, xlswrite.m
Please let me know of any bugs.
Cite As
Richard de Garis (2026). Calculate Excel Range (https://au.mathworks.com/matlabcentral/fileexchange/30180-calculate-excel-range), MATLAB Central File Exchange. Retrieved .
General Information
- Version 1.3.1.0 (6.91 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
| Version | Published | Release Notes | Action |
|---|---|---|---|
| 1.3.1.0 | A bug was introduced with Matlab R2024b, where the function signature for ind2sub(sz, ind) no longer accepts scalar values for sz. This has now been fixed. A big thank you to Adriano Demetrio for identifying the bug. |
||
| 1.3.0.0 | Added Excel COM workbook handle to argument list, to enable use of named ranges when multiple workbooks are open. This is ignored if not using a named range |
||
| 1.0.0.0 |
