- Advanced Excel Functions Tutorial
- Advanced Excel Functions - Home
- Compatibility Functions
- Advanced Excel Functions - Cube
- Database Functions
- Date & Time Functions
- Engineering Functions
- Financial Functions
- Information Functions
- Advanced Excel Functions - Logical
- Lookup & Reference Functions
- Math & Trignometric Functions
- Statistical Functions
- Useful Resources
- Quick Guide
- Useful Resources
- Discussion
Advanced Excel Information - CELL Function
Description
The CELL function returns information about the formatting, location, or contents of a cell.
Syntax
CELL (info_type, [reference])
Arguments
Argument | Description | Required/ Optional |
---|---|---|
Info_type | A text value that specifies what type of cell information you want to return. The possible values of the Info_type, are shown in the Table Info_type Values below. |
Required |
Reference | The cell that you want information about. If omitted, the information specified in the Info_type argument is returned for the last cell that was changed. If the reference argument is a range of cells, the CELL function returns the information for only the upper left cell of the range. |
Optional |
Info_type Values
Info_type | Type of cell information to return |
---|---|
"address" | Reference of the first cell in reference, as text. |
"col" | Column number of the cell in reference. |
"color" | The value 1 if the cell is formatted in color for negative values. Otherwise returns 0 (zero). |
"contents" | Value of the upper-left cell in reference. Not a formula. |
"filename" |
Filename (including full path) of the file that contains reference, as text. Returns empty text ("") if the Worksheet that contains reference has not yet been saved. |
"format" |
Text value corresponding to the number format of the cell. The text values for the various formats are shown in the table CELL Format Codes below. Returns "-" at the end of the text value if the cell is formatted in color for negative values. Returns "()" at the end of the text value if the cell is formatted with parentheses for positive or all values. If you later apply a different format to the referenced cell, you must recalculate the Worksheet to update the results of the CELL function. |
"parentheses" |
The value 1 if the cell is formatted with parentheses for positive or all values. Otherwise returns 0. |
"prefix" |
Text value corresponding to the "label prefix" of the cell. Returns
|
"protect" |
The value 0 if the cell is not locked. Otherwise, returns 1 (if the cell is locked). |
"row" | Row number of the cell in reference. |
"type" | Text value corresponding to the type of data in the cell.
|
"width" | Column width of the cell, rounded off to an integer. Each unit of column width is equal to the width of one character in the default font size. |
CELL Format Codes
The following table describes the text values that the CELL function returns when the Info_type argument is "format" and the reference argument is a cell that is formatted with a built-in number format.
Excel Format of the Cell | What CELL Function returns |
---|---|
General | "G" |
0 | "F0" |
#,##0 | ",0" |
0.00 | "F2" |
#,##0.00 | ",2" |
$#,##0_);($#,##0) | "C0" |
$#,##0_);[Red]($#,##0) | "C0-" |
$#,##0.00_);($#,##0.00) | "C2" |
$#,##0.00_);[Red]($#,##0.00) | "C2-" |
0% | "P0" |
0.00% | "P2" |
0.00E+00 | "S2" |
# ?/? or # ??/?? | "G" |
m/d/yy or m/d/yy h:mm or mm/dd/yy | "D4" |
d-mmm-yy or dd-mmm-yy | "D1" |
d-mmm or dd-mmm | "D2" |
mmm-yy | "D3" |
mm/dd | "D5" |
h:mm AM/PM | "D7" |
h:mm:ss AM/PM | "D6" |
h:mm | "D9" |
h:mm:ss | "D8" |
Notes
If info_type is not one of the recognized types as given above, CELL Function returns #VALUE! Error.
Applicability
Excel 2007, Excel 2010, Excel 2013, Excel 2016