Function Repository Resource:

SpreadsheetIndexToPosition

Source Notebook

Convert spreadsheet coordinates to a Wolfram Language position

Contributed by: Sjoerd Smit

ResourceFunction["SpreadsheetIndexToPosition"][str]

conversts a spreadsheet cell reference such as B3 to a Wolfram {row,col} position pair.

Details

If the string does not have a row number, the column index will be returned instead.
Spreadsheet indices list column before row, so these get reversed in the conversion.

Examples

Basic Examples (2) 

Convert a spreadsheet cell reference to a Position pair:

In[1]:=
ResourceFunction["SpreadsheetIndexToPosition"]["A2"]
Out[1]=
In[2]:=
ResourceFunction["SpreadsheetIndexToPosition"]["AB1"]
Out[2]=

SpreadsheetIndexToPosition is not sensitive to case:

In[3]:=
ResourceFunction["SpreadsheetIndexToPosition"]["ab1"]
Out[3]=

Scope (1) 

If no row number is provided, only the column number is returned:

In[4]:=
ResourceFunction["SpreadsheetIndexToPosition"]["AC"]
Out[4]=

Properties and Relations (1) 

The resource function PositionToSpreadsheetIndex is the inverse of SpreadsheetIndexToPosition:

In[5]:=
ResourceFunction["SpreadsheetIndexToPosition"]@
 ResourceFunction["PositionToSpreadsheetIndex"][
  {10, 33}
  ]
Out[5]=
In[6]:=
ResourceFunction["PositionToSpreadsheetIndex"]@
 ResourceFunction["SpreadsheetIndexToPosition"][
  "AA3"
  ]
Out[6]=

Publisher

Sjoerd Smit

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.0 – 06 May 2024

Related Resources

License Information