Excel - CELL Function



CELL Function

The Excell CELL function retrieves crucial cell information like the address, cell content, file location, and formatting. Whenever you import the data from the external source into Excel, you can quickly verify whether the cell contains text constant or integer values before evaluating the complex formula. It is categorized under the Excel Information function.

Compatibility

This advanced Excel function is compatible with the following versions of MS-Excel −

  • Excel for Microsoft 365
  • Excel for Microsoft 365 for Mac
  • Excel for the web
  • Excel 2024
  • Excel 2024 for Mac
  • Excel 2021
  • Excel 2021 for Mac
  • Excel 2019
  • Excel 2016
  • Excel for iPad
  • Excel for iPhone
  • Excel for Android tablets
  • Excel for Android phones
  • Excel 2013
  • Excel 2010

Syntax

The syntax of the CELL function is as follows −

=CELL(info_type, [reference])

Arguments

You can use the following arguments with the CELL function −

Argument Description Required/ Optional
Info_type

It specifies a text value representing info_type.

The possible values of the Info_type, are depicted in the Table Info_type Values below.

Required
Reference

It indicates the cell reference whose information you wish to know.

If skipped, the information specified in the Info_type argument is returned for the last changed cell.

If the reference argument denotes cell range, the CELL function will retrieve the information of only the first cell in that range.

Optional

Info_type Values

Info_type Type of cell information to return
"address" It denotes the reference of the first cell as text.
"col" It indicates the column number of the reference.
"color" The value 1 if the cell is formatted in color for negative values. Otherwise returns 0 (zero).
"contents" It specifies the first cell's value in reference. Not a formula.
"filename"

It specifies the complete path name of the workbook, which corresponds to the reference in the text form.

If the worksheet containing the cell reference has not been saved yet, it retrieves the empty text ("").

"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.

If the color formatting is implied for negative values, it retrieves "-" at the rear of the text value.

If the cell is formatted with parentheses for positive or all values, it retrieves "()" at the end of the text value.

"parentheses"

The value 1 if the cell is formatted with parentheses for positive or all values.

Otherwise returns 0.

"prefix"

It retrieves the Text value corresponding to the "label prefix" of the cell. Returns

  • single quotation mark (') if left-aligned text exists in the cell.
  • double quotation mark (") if right-aligned text exists in a cell.
  • caret (^) if the center alignment text exists in a cell.
  • backslash (\) if the fill-aligned text exists in a cell.
  • empty text ("") if the cell comprises something else.
"protect"

It returns 0 for the unlocked cell.

Otherwise, it returns 1 (for a locked cell).

"row" It specifies the row number of the cell reference.
"type"

It specifies the Text value corresponding to the data type in the cell.

  • "b" stands for blank used for the empty cell values.
  • "l" is the label for a text constant in a cell.
  • "v" for value if the cell comprises values other than blank and text constant.
"width" It specifies the cell's Column Width, rounded off to an integer.

CELL Format Codes

The following table represents the Excel format of the cell and its corresponding value when evaluating the CELL function.

Excel Format of the Cell What CELL Function returns
General "G"
0 "F0"
#,##0 ",0"
0.00 "F2"
#,##0.00 ",2"
#,##0_);(#,##0_);(#,##0) "C0"
#,##0_);[Red](#,##0_);[Red](#,##0) "C0-"
#,##0.00_);(#,##0.00_);(#,##0.00) "C2"
#,##0.00_);[Red](#,##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"

Points to Remember

  • If the recognized types depicted in the above table are not specified in the first argument, "info_type", then the CELL function will retrieve the #VALUE! Error.
  • If the "info_type" value is not enclosed in the double quotation, then the CELL function returns the #NAME? Error.

Example of CELL Function

Practice the following example to learn the deployment of the CELL function in Excel.

Extracting the Address of Maximum Sales Production

Extracting Address of Maximum Sales Production1

You can combine the CELL function with the INDEX and MATCH functions to get the address of the highest sales production in the given array. You may enter the formula =CELL("address", INDEX(A2:B8, MATCH(MAX(A2:B8), B2:B8, 0),2)) in the C11 cell. In this expression, the MATCH function searches the lookup value MAX(A2:A8) in the cell range B2:B8, the INDEX function returns the value at the specified index, and the CELL function retrieves the address of the max sales production in the given cell range.

Extracting Address of Maximum Sales Production2

After that, hit the Enter tab. Therefore, the address of the highest sales production is $B$5.

Extracting Address of Maximum Sales Production3

Download Practice Sheet

You can download and use the sample data sheet to practice the CELL function.

Advertisements