Lookup and reference functions
FORMULATEXT
Matches all 4 recorded answers
Recorded: 4 workbook cells. How we measure this · See the Rust code
Local names in 40 languages
| Language | Name in Excel |
|---|---|
| Arabic | FORMULATEXT |
| Bulgarian | FORMULATEXT |
| Czech | FORMULATEXT |
| Danish | FORMELTEKST |
| German | FORMULATEXT |
| Greek | FORMULATEXT |
| English (Australia) | FORMULATEXT |
| English (United Kingdom) | FORMULATEXT |
| English (United States) | FORMULATEXT |
| Spanish | FORMULATEXTO |
| Estonian | FORMULATEXT |
| Finnish | KAAVA.TEKSTI |
| French | FORMULETEXTE |
| Hebrew | FORMULATEXT |
| Croatian | FORMULATEXT |
| Hungarian | KÉPLETSZÖVEG |
| Indonesian | FORMULATEXT |
| Italian | FORMULATEXT |
| Japanese | FORMULATEXT |
| Korean | FORMULATEXT |
| Lithuanian | FORMULATEXT |
| Latvian | FORMULATEXT |
| Norwegian | FORMULATEXT |
| Dutch | FORMULETEKST |
| Polish | FORMUŁA.TEKST |
| Portuguese (Brazil) | FORMULATEXT |
| Portuguese (Portugal) | FÓRMULA.TEXTO |
| Romanian | FORMULATEXT |
| Russian | Ф.ТЕКСТ |
| Slovak | FORMULATEXT |
| Slovenian | FORMULATEXT |
| Serbian (Latin) | FORMULATEXT |
| Swedish | FORMELTEXT |
| Thai | FORMULATEXT |
| Turkish | FORMÜLMETNİ |
| Ukrainian | FORMULATEXT |
| Vietnamese | FORMULATEXT |
| Chinese (Simplified) | FORMULATEXT |
| Chinese (Hong Kong) | FORMULATEXT |
| Chinese (Traditional) | FORMULATEXT |
Names from Microsoft's support site.
What it does
FORMULATEXT(reference)
FORMULATEXT(reference) returns the stored formula text of the referenced cell, including the leading equals sign. It inspects the workbook’s formula rather than converting the cell’s calculated value back into an expression.
Try it
Input cells in this preview hold values rather than authored formulas, so FORMULATEXT cannot retrieve a stored formula here.
In Excel put =7*6 in B2, then enter =FORMULATEXT(B2) elsewhere. It returns the text "=7*6", while B2 displays 42. The preview input grid currently supplies cell values, so its B2=1 control returns a worksheet error instead of an authored formula.
Quirks
Microsoft documents #N/A when the target has no formula, the formula exceeds 8192 characters, worksheet protection hides it, or an external source workbook is closed. Invalid argument types give #VALUE!. A multi-cell reference selects its upper-left cell. A self-reference can return its own text without normal circular calculation.
How to implement
Resolve the reference to its first cell and ask the workbook host for its stored formula text. Do not evaluate that formula to obtain the text and do not reconstruct spelling from the result. The current host interface distinguishes “known cell without formula” (#N/A) from “formula information unavailable” (a typed refusal); it also rejects a closed external workbook as #N/A. The host must supply formula length/protection policy and formula-bar spelling. This is a host-backed function, not a pure numeric kernel.
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.
FORMULATEXT · 1 lines · calc-func/src/catalogue/host_facts.rs on GitHub5 formulatext_fn "FORMULATEXT" (1, 1) [F "reference"] |s, a, sv| { formulatext(s, a, sv) }
formulatext · 12 lines · calc-func/src/catalogue/host_facts.rs on GitHubfn formulatext(site: &Site<'_>, a: &[CalcValue], sv: &mut EvalServices<'_>) -> Step<CalcValue> {
let at = first_cell(site, a, 0)?;
// dc-ylr: Excel gives FORMULATEXT of a reference to a closed workbook #N/A.
if sv.host().is_some_and(|host| host.is_external_sheet(at.sheet())) {
return fail(WorksheetErrorCode::NA);
}
match sv.host().and_then(|host| host.formula_text(at)) {
Some(Some(text)) => Ok(crate::catalogue::kit::text_value(&text)),
Some(None) => fail(WorksheetErrorCode::NA),
None => Err(site.not_modelled(Some(0))),
}
}
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 same-input comparison between named Excel builds is recorded for this function here. The documented behaviour below is not a measurement of every Excel release.
Alternatives
ISFORMULA checks whether a cell contains a formula. TEXT formats its calculated value rather than returning its formula text.
Named variants
No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents