Returns information about the formatting, location, or contents of the upper-left cell in a reference.
Syntax
CELL(info_type,reference)
Info_type is a text value that specifies what type of cell information you want. The following list shows the possible values of info_type and the corresponding results.
Info_type | Returns |
---|---|
"address" | Reference of the first cell in reference, as text. |
"col" | Column number of the cell in reference. |
"contents" | Value of the upper-left cell in reference; not a formula. |
"row" | Row number of the cell in reference. |
"type" | Text value corresponding to the type of data in the cell. Returns "b" for blank if the cell is empty, "l" for label if the cell contains a text constant, and "v" for value if the cell contains anything else. |
Reference is the cell that you want information about. If omitted, information specified in info_type is returned for the last cell that was changed.
Remark
The CELL function is provided for compatibility with other spreadsheet programs.
Example
The example may be easier to understand if you copy it to a blank spreadsheet.
- Create a blank spreadsheet.
- Select the example in the Help topic.
Selecting an example from Help
- Press CTRL+C.
- In the spreadsheet, select cell A1, and press CTRL+V.
- To switch between viewing the formula that returns the result and the result in the cell, select the cell and press F2 and then ENTER, or click Commands and Options on the spreadsheet toolbar, click the Formula tab, and look in the Formula in active cell (active cell) box.
Data | |
---|---|
5-Mar | |
TOTAL | |
Formula | Description (Result) |
=CELL("row",A20) | The row number of cell A20 (20) |
=CELL("type",A2) | The type of data in cell A2 (v) |
=CELL("contents",A3) | The content of cell A3 (TOTAL) |