This Excel tutorial demonstrates the CELL function's versatility in retrieving cell information. Instead of relying on visual inspection or ribbon commands, the CELL function offers a faster, more reliable method to access various cell properties. It can reveal whether a cell is protected, its number format, column width, and even the complete file path of the workbook.
Excel CELL Function: Syntax and Basic Uses
The CELL function returns diverse information about a cell, such as its contents, formatting, and location. Its syntax is:
CELL(info_type, [reference])
Where:
-
info_type
(required): Specifies the type of information to retrieve. -
reference
(optional): The cell to analyze. If a range is provided, it uses the top-left cell. If omitted, it defaults to the last modified cell.
Info_type Values
The following table details the info_type
options:
Info_type | Description |
---|---|
"address" | Cell address (text). |
"col" | Column number. |
"color" | 1 if negatively formatted; otherwise 0. |
"contents" | Cell value (formula results included). |
"filename" | Full file path (text). Returns "" if unsaved. (Not supported in Excel Online, Mobile, or Starter) |
"format" | Number format code (see "Format Codes" section). (Not supported in Excel Online, Mobile, or Starter) |
"parentheses" | 1 if formatted with parentheses for positive or all values; otherwise 0. (Not supported in Excel Online, Mobile, or Starter) |
"prefix" | Text alignment prefix (' for left, " for right, ^ for center, \ for fill, "" otherwise; "" for numeric values). (Not supported in Excel Online, Mobile, or Starter) |
"protect" | 1 if locked; 0 if unlocked (Note: "locked" ≠ "protected"). (Not supported in Excel Online, Mobile, or Starter) |
"row" | Row number. |
"type" | "b" (blank), "l" (label), or "v" (value). |
"width" | Column width (rounded integer). (Not supported in Excel Online, Mobile, or Starter) |
Format Codes
The "format" info_type
returns codes representing number formats:
Format | Returned Value |
---|---|
General | G |
0 | F0 |
0.00 | F2 |
#,##0 | ,0 |
#,##0.00 | ,2 |
$#,##0 or $#,##0_);($#,##0) | C0 |
$#,##0.00 or $#,##0.00_);($#,##0.00) | C2 |
0% | P0 |
0.00% | P2 |
0.00E 00 | S2 |
m/d/yy or m/d/yy h:mm or mm/dd/yy | D4 |
d-mmm-yy or dd-mmm-yy | D1 |
... (and many more) | ... |
Custom formats may yield other values. The first letter often indicates the format type (G=General, C=Currency, P=Percentage, S=Scientific, D=Date). Numbers often represent decimal places. Commas and parentheses may be appended to the code.
Advanced CELL Function Examples
Beyond basic usage, CELL can be combined with other functions:
-
Lookup Result Address:
CELL("address", INDEX(return_column, MATCH(lookup_value, lookup_column, 0)))
retrieves the address of a VLOOKUP or INDEX/MATCH result. -
Hyperlink to Lookup Result:
HYPERLINK("#"&CELL("address", ...), "Link Name")
creates a hyperlink to the lookup result. -
File Path Extraction: Using
CELL("filename")
and text functions likeLEFT
,MID
,RIGHT
, andSEARCH
, you can extract parts of the file path (workbook name, sheet name, etc.).
This enhanced explanation provides a more comprehensive understanding of the CELL function's capabilities and applications within Excel. Remember that some info_type
values are not supported in all Excel versions.
The above is the detailed content of Excel CELL function with formula examples. For more information, please follow other related articles on the PHP Chinese website!

This tutorial explains how to calculate the median of numerical data in Excel using the MEDIAN function. The median, a key measure of central tendency, identifies the middle value in a dataset, offering a more robust representation of central tenden

Master Google Sheets COUNTIF: A Comprehensive Guide This guide explores the versatile COUNTIF function in Google Sheets, demonstrating its applications beyond simple cell counting. We'll cover various scenarios, from exact and partial matches to han

This tutorial provides a comprehensive guide to sharing Excel workbooks, covering various methods, access control, and conflict resolution. Modern Excel versions (2010, 2013, 2016, and later) simplify collaborative editing, eliminating the need to m

This tutorial explores various methods for converting .xls files to .jpg images, encompassing both built-in Windows tools and free online converters. Need to create a presentation, share spreadsheet data securely, or design a document? Converting yo

This tutorial clarifies the function of Excel names and demonstrates how to define names for cells, ranges, constants, or formulas. It also covers editing, filtering, and deleting defined names. Excel names, while incredibly useful, are often overlo

This tutorial clarifies the distinction between standard deviation and standard error of the mean, guiding you on the optimal Excel functions for standard deviation calculations. In descriptive statistics, the mean and standard deviation are intrinsi

This Excel tutorial demonstrates how to calculate square roots and nth roots. Finding the square root is a common mathematical operation, and Excel offers several methods. Methods for Calculating Square Roots in Excel: Using the SQRT Function: The

Unlock the Power of Google Sheets: A Beginner's Guide This tutorial introduces the fundamentals of Google Sheets, a powerful and versatile alternative to MS Excel. Learn how to effortlessly manage spreadsheets, leverage key features, and collaborate


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment