Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • How to Create Thermometer Chart in Excel
  • Create Scatter Chart in Excel
  • How To Load Analysis ToolPak in Excel
  • How to combine 2 or more chart types in a single chart in Excel
  • How to calculate correlation coefficient Correlation in Excel

References

  • Count unique text values with criteria
  • How to retrieve first match between two ranges in Excel
  • How to use Excel VLOOKUP Function
  • How to create dynamic named range with OFFSET in Excel
  • How to use Excel OFFSET function

Data Validations

  • Excel Data validation specific characters only
  • Excel Data validation require unique number
  • Excel Data validation only dates between
  • Excel Data validation no punctuation
  • Excel Data validation don’t exceed total

CELL function: Description, Usage, Syntax, Examples and Explanation

by

What is CELL function in Excel?

CELL function is one of the Information functions in Microsoft Excel that returns info about the formatting, location, or contents of a cell. For example, if you want to verify that a cell contains a numeric value instead of text before you perform a calculation on it, you can use the following formula:

= IF( CELL(“type”, A1) = “v”, A1 * 2, 0)

This formula calculates A1*2 only if cell A1 contains a numeric value, and returns 0 if A1 contains text or is blank.

Syntax of CELL function

CELL(info_type, [reference])

The CELL function syntax has the following arguments:

  • Info_type: A text value that specifies what type of cell information you want to return. The following list shows the possible values of the Info_type argument 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.
“color” The value 1 if the cell is formatted in color for negative values; otherwise returns 0 (zero).

Note: This value is not supported in Excel Online, Excel Mobile, and Excel Starter.

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

Note: This value is not supported in Excel Online, Excel Mobile, and Excel Starter.

“format” Text value corresponding to the number format of the cell. The text values for the various formats are shown in the following table. 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.

Note: This value is not supported in Excel Online, Excel Mobile, and Excel Starter.

“parentheses” The value 1 if the cell is formatted with parentheses for positive or all values; otherwise returns 0.

Note: This value is not supported in Excel Online, Excel Mobile, and Excel Starter.

“prefix” Text value corresponding to the “label prefix” of the cell. Returns single quotation mark (‘) if the cell contains left-aligned text, double quotation mark (“) if the cell contains right-aligned text, caret (^) if the cell contains centered text, backslash (\) if the cell contains fill-aligned text, and empty text (“”) if the cell contains anything else.

Note: This value is not supported in Excel Online, Excel Mobile, and Excel Starter.

“protect” The value 0 if the cell is not locked; otherwise returns 1 if the cell is locked.

Note: This value is not supported in Excel Online, Excel Mobile, and Excel Starter.

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

Note: This value is not supported in Excel Online, Excel Mobile, and Excel Starter.

  • Reference(Optional): 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.
Worked Example:   How to get full workbook name and path in Excel

CELL format codes

The following list 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.

Worked Example:   How to retrieve workbook name only in Excel
If the Excel format is The CELL function returns
General “G”
“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”
Worked Example:   How to get address of first cell in range in Excel

Note: If the Info_type argument in the CELL function is “format” and you later apply a different format to the referenced cell, you must recalculate the worksheet to update the results of the CELL function.

Example of CELL function

Steps to follow:

1. Open a new Excel worksheet.

2. Copy data in the following table below and paste it in cell A1

Note: For formulas to show results, select them, press F2 key on your keyboard and then press Enter.

You can adjust the column widths to see all the data, if need be.

Data
75
Hello, world!
Formula Description Result
=CELL(“row”, A20) The row number of cell A20. 20
=CELL(“contents”, A3) The contents of cell A3. Hello, world!
=CELL(“type”, A2) The data type of cell A2. A data type of “v” indicates value. v

Post navigation

Previous Post:

N function: Description, Usage, Syntax, Examples and Explanation

Next Post:

NA function: Description, Usage, Syntax, Examples and Explanation

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • IFS function: Description, Usage, Syntax, Examples and Explanation
  • AND function: Description, Usage, Syntax, Examples and Explanation
  • FALSE function: Description, Usage, Syntax, Examples and Explanation
  • IF function: Description, Usage, Syntax, Examples and Explanation
  • How to use Excel XOR Function

Date Time

  • Add business days to date in Excel
  • WORKDAY function: Description, Usage, Syntax, Examples and Explanation
  • Get first day of month in Excel
  • Display the current date in Excel
  • Assign points based on late time in Excel

Grouping

  • Group times into unequal buckets in Excel
  • Running count group by n size in Excel
  • How to randomly assign people to groups in Excel
  • Group arbitrary text values in Excel
  • Group times into 3 hour buckets in Excel

General

  • Spell Check in Excel
  • How to count total number of cells in a rectangular range in Excel
  • How to calculate percent of goal in Excel
  • How to calculate percentage of total in Excel
  • How to get original price from percentage discount in Excel
© 2023 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning