Skip to main content

Excel CELL Function

The CELL function returns the requested information about a specified cell, such as the cell’s location, contents, formatting, and more.

cell function 1


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:
  • Single quotation mark (') if the content in the cell is left-aligned;
  • Double quotation mark (") if the content in the cell is right-aligned;
  • Caret (^) if the content in the cell is centered;
  • Backslash (\) if the content in the cell is fill-aligned;
  • Empty text () if the label prefix is anything else
"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:
  • "b" (blank) for an empty cell;
  • "l" (label) for a text constant;
  • "v" (value) for anything else
"width" Returns 2 items in an array:
  • The column width of the cell that is rounded to the nearest integer;
  • A Boolean value: TRUE if the column width is the default or FALSE otherwise

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.

cell function 2

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

Excel TYPE Function

The Excel TYPE Function returns a number indicating the data type of a value.

Excel ERROR.TYPE Function

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.

Excel ROW Function

The Excel ROW function returns the row number of a reference.

Excel COLUMN Function

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 AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ...
Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup...
Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List...
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...

Description


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.
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations