Information functions
CELL
Matches all 771 recorded answers
Recorded: 771 workbook cells. How we measure this · See the Rust code
Local names in 40 languages
| Language | Name in Excel |
|---|---|
| Arabic | CELL |
| Bulgarian | CELL |
| Czech | POLÍČKO |
| Danish | CELLE |
| German | ZELLE |
| Greek | CELL |
| English (Australia) | CELL |
| English (United Kingdom) | CELL |
| English (United States) | CELL |
| Spanish | CELDA |
| Estonian | CELL |
| Finnish | SOLU |
| French | CELLULE |
| Hebrew | CELL |
| Croatian | CELL |
| Hungarian | CELLA |
| Indonesian | CELL |
| Italian | CELLA |
| Japanese | CELL |
| Korean | CELL |
| Lithuanian | CELL |
| Latvian | CELL |
| Norwegian | CELLE |
| Dutch | CEL |
| Polish | KOMÓRKA |
| Portuguese (Brazil) | CÉLULA |
| Portuguese (Portugal) | CÉL |
| Romanian | CELL |
| Russian | ЯЧЕЙКА |
| Slovak | CELL |
| Slovenian | CELL |
| Serbian (Latin) | CELL |
| Swedish | CELL |
| Thai | CELL |
| Turkish | HÜCRE |
| Ukrainian | CELL |
| Vietnamese | CELL |
| Chinese (Simplified) | CELL |
| Chinese (Hong Kong) | CELL |
| Chinese (Traditional) | CELL |
Names from Microsoft's support site.
What it does
CELL(info_type, [reference])
CELL(info_type, [reference]) returns one property of a cell, selected by name.
Microsoft's published info_type table, verbatim:
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). |
"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. |
"format" | Text value corresponding to the number format of the cell. |
"parentheses" | The value 1 if the cell is formatted with parentheses for positive or all values; otherwise returns 0. |
"prefix" | Text value corresponding to the "label prefix" of the cell. |
"protect" | The value 0 if the cell is not locked; otherwise returns 1 if the cell is locked. |
"row" | Row number of the cell in reference. |
"type" | Text value corresponding to the type of data in the cell. |
"width" | Returns an array with 2 items. |
Several of these — "color", "parentheses", "prefix", and much of "format" — are
survivals from Lotus 1-2-3 compatibility and from Excel's macro-sheet era. They still answer,
but they describe a formatting world that modern workbooks mostly do not use.
Arguments
info_type — required. Text naming the property. It is coerced to text and matched
case-insensitively after trimming, so "ROW", "row" and " Row " are the same request. A
name outside the twelve is a failure, not a null result.
reference — optional, and this is the argument position most commonly misunderstood.
Microsoft's own caveat is worth quoting because it is unusually blunt for a reference page:
"Although technically reference is optional, including it in your formula is encouraged, unless
you understand the effect its absence has on your formula result."
What its absence does: CELL falls back to the last cell that was changed, which is a piece
of application state, not a property of the formula. The documented consequences are that
calculation timing varies by platform, that co-authoring can report the wrong active cell, and
that a plain recalculation (F9) can produce a new result with no edit anywhere. That is why the
function's declared volatility is VolatileContextual and its thread-safety class is
HostSerialized: an argument-free CELL is a formula whose answer depends on what the user did
last.
Supply the reference. There is no case in which omitting it makes a formula more correct.
Note also that reference is a reference position, not a value position: the live reference
survives argument preparation, which is what lets "address" and "row" mean anything. Handing
CELL a computed value where a reference is expected is a failure, not a coercion.
Try it
Quirks
Result and edge cases
The return kind depends on info_type: Text for "address", "filename", "format",
"prefix" and "type"; Number for "col", "row", "color", "parentheses" and
"protect"; whatever the cell holds for "contents"; and an array of two items for
"width" — the only info_type whose result is not a scalar, and a shape that will spill or be
intersected depending on context.
- A multi-cell reference is reduced.
"address"reports the first cell,"contents"the upper-left.CELLdoes not aggregate. "contents"returns the value, never the formula.FORMULATEXTis the function for the formula text."filename"on an unsaved workbook has a documented-empty answer in the folklore and no observation in this Handbook."type"is coarse. It reports a one-letter classification of the cell's content, not the fine-grained kind thatTYPEreturns. The two functions have similar names and different jobs; see "Relationships"."format"is locale- and version-sensitive. The text codes describe number formats, and which code a given format maps to is a per-build fact this Handbook has not recorded.- Volatility. With
referencesupplied the function is still declaredVolatileContextual— the properties it reads (format, width, protection) can change without any formula input changing, and Excel's dependency graph does not track formatting edits the way it tracks values. ACELL("format", A1)result can therefore be stale after a formatting change until a recalculation happens.
Errors
Microsoft's page is the documentation of record; the Handbook has read its info_type table and
its reference-argument caveat, and does not have a documented error table for this function to
reproduce.
- an unrecognised
info_type—#VALUE! - a
referenceargument that is not a reference —#VALUE! - an arity failure (zero arguments, or three) —
#VALUE! - no host available — the call is refused rather than answered
#REF! from a deleted target and #NAME? from an unresolvable name would arise before CELL
runs, in reference resolution (coercion and lifting).
How to implement
Notes for implementers
CELLcannot be implemented in the function layer. It must be a declared host query with a defined failure mode when no host is present. Faking"filename"or"format"from local state produces answers that look right and are not.- The reference must survive preparation unresolved. If the dispatch layer dereferences,
"address","row","col"and"width"all lose their subject. - The omitted-
referencepath is a different query, against application state (last changed cell), not against an argument. It should be modelled as such, and its non-determinism documented rather than smoothed over. "width"returns an array of two. A scalar-shaped return path will silently drop half the answer."format"and"prefix"are locale- and version-scoped. Any claim about their outputs must name the build and locale, per the Handbook's claim rules.
Rust code
Show the CalcFunc source of this function
Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.
CELL · 1 lines · calc-func/src/catalogue/host_facts.rs on GitHub1 cell_fn "CELL" (1, 2) [V "info_type", F "reference"] |s, a, sv| { cell(s, a, sv) }
Kernels shared with other functions
first_cellcatalogue/host_factscell_valuecatalogue/host_factscolumn_letterscatalogue/host_factsfactscatalogue/host_factsqualified_sheetcatalogue/host_factscellcatalogue/host_factss_numbercatalogue/host_factsinfocatalogue/host_factssheetcatalogue/host_factssectionsformat/cell_infotokensformat/cell_infois_date_timeformat/cell_infodate_time_classformat/cell_infoplacesformat/cell_infonumber_classformat/cell_infoclassifyformat/cell_infosplit_prefixported/a1_refsparse_cell_tokenported/a1_refsparse_column_tokenported/a1_refsparse_row_tokenported/a1_refsparse_a1_referenceported/a1_refsaddress_name_characterported/addressaddress_name_is_referenceported/addressquote_sheet_text_if_neededported/address
Argument and result plumbing
failcatalogue/kitgridcatalogue/kittext_argcatalogue/kittext_valuecatalogue/kit
No implementation has been published with a Handbook test suite for this function.
Version differences
No comparison between specific Excel builds is recorded here yet. This does not establish that all builds behave alike.
Alternatives
Relationships
INFOisCELL's sibling: same category, same host dependence, same "cannot be evaluated without Excel" property, but asking about the environment rather than about a cell.TYPEandCELL("type", …)are not the same function and do not return the same alphabet.TYPEreturns a numeric kind code for a value;CELL("type", …)returns a one-letter classification of a cell. If you want to know what kind of value you have, useTYPE.ROWandCOLUMNgive the same numbers asCELL("row", …)andCELL("col", …), without the host-query machinery, and are the better choice.ADDRESSbuilds an address from coordinates;CELL("address", …)reads one from a reference. They meet in the middle.SHEETandSHEETSanswer the sheet-level questionsCELLdoes not.ISFORMULAandFORMULATEXTanswer the formula questionsCELL("contents")andCELL("type")cannot.CELL("filename", …)is the traditional route to the workbook or sheet name, usually wrapped inMID/FIND. It is fragile — it depends on the file having been saved and on the path's punctuation — and it is the reason many workbooks break when moved.
Named variants
No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents