Excel CELL Function
The CELL function returns the requested information about a specified cell, such as the cell’s location, contents, formatting, and more.
Syntax
=CELL(info_type, [reference])
Arguments
- info_type (required): A text value that specifies which type of cell information to be returned. For more information, please see the info_type values table below.
- reference (optional): The cell to retrieve its information:
- The reference should be supplied as a single cell;
- If supplied as a range of cells, CELL will get the information of the top left cell of the range;
- If omitted, the information about the active cell will be returned.
info_type values
The table below lists all possible values accepted by the CELL function that can be used as the info_type argument.
info_type | Description Note: The cell below indicates the upper-left (first) cell in reference |
"address" | Returns the address of the cell (as text) |
"col" | Returns the column number of the cell |
"color" | Returns 1 if the cell is formatted in color for negative numbers; Returns 0 otherwise |
"contents" | Returns the value of the cell. If the cell contains a formula, the calculated value will be returned |
"filename" | Returns the file name and full path to the workbook that contains the cell as text. If the worksheet that contains the reference has not yet been saved, an empty string ("") will be returned |
"format" | Returns a format code that corresponds to the number format of the cell as text. For more information, please see CELL format codes. |
"parentheses" | Returns 1 if the cell is formatted with parentheses for positive or all values; Returns 0 otherwise |
"prefix" | Returns a text value that corresponds to the label prefix of the cell:
|
"protect" | Returns 1 if the cell is locked; Returns 0 otherwise |
"row" | Returns the row number of the cell |
"type" | Returns a text value that corresponds to the type of data in the cell:
|
"width" | Returns 2 items in an array:
|
Note: The "color", "filename", "format", "parentheses", "prefix", "protect" and "width" values are not supported in Excel for the web, Excel Mobile, and Excel Starter.
CELL format codes
The table below shows the text codes that correspond to specific number formats of the cell when info_type is set to "format".
Format code returned | Corresponding number format |
G | General |
F0 | 0 |
,0 | #,##0 |
F2 | Returns |
,2 | #,##0.00 |
C0 | $#,##0_);($#,##0) |
C0- | $#,##0_);[Red]($#,##0) |
C2 | $#,##0.00_);($#,##0.00) |
C2- | $#,##0.00_);[Red]($#,##0.00) |
P0 | 0% |
P2 | 0.00% |
S2 | 0.00E+00 |
G | # ?/? or # ??/?? |
D4 | m/d/yy or m/d/yy h:mm or mm/dd/yy |
D1 | d-mmm-yy or dd-mmm-yy |
D2 | d-mmm or dd-mmm |
D3 | mmm-yy |
D5 | mm/dd |
D7 | h:mm AM/PM |
D6 | h:mm:ss AM/PM |
D9 | h:mm |
D8 | h:mm:ss |
Note: The number formats above are all built-in formats. The "-" will be added at the end of the code values if the cell is formatted in color for negative values. If the cell is formatted with parentheses for positive or all values, "()" will be returned at the end of the code.
Return Value
The CELL function returns the requested information.
Function Notes
- info_type must be enclosed in double quotes ("") if it’s directly entered in a CELL formula. If you don’t type the argument but reference it, no double quotes are needed.
- reference is optional for some info_type values. However, it’s recommended to use an address like A1 to avoid unexpected results.
- You must recalculate the worksheet (press F9) to update the results of the CELL function if you later apply a different format to the referenced cell.
- CELL will return the #VALUE! error if info_type is not one of the recognized types.
- CELL will return the #NAME? error if either of the arguments is text values that are not enclosed in double quotes.
Example
To get the information of the cell B3 according to the info types as shown in the below table, please copy or enter the formula below in the top cell, press Enter to get the result, and then drag the fill handle (at the lower right corner of the result cell) down to apply the formula to below cells.
=CELL(C3,$B$3)
√ Note: The dollar signs ($) above indicate absolute references, which means the reference in the formula won't change when you move or copy the formula to other cells. However, there are no dollar signs added to the info_type since you want it to be dynamic.
Also, you can enter the info_type argument directly in the formula as shown below. Make sure it is enclosed with double quotes:
=CELL("address",$B$3)
Related functions
The Excel TYPE Function returns a number indicating the data type of a value.
The Excel ERROR.TYPE function returns a number that corresponds to a specific error value. If no error exists, ERROR.TYPE returns the #N/A error.
The Excel ROW function returns the row number of a reference.
The COLUMN function returns the number of column which formula appears or returns the column number of given reference.
The Best Office Productivity Tools
Kutools for Excel - Helps You To Stand Out From Crowd
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)
- One second to switch between dozens of open documents!
- Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
- Increases your productivity by 50% when viewing and editing multiple documents.
- Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.
