Lookup and reference functions
FIELDVALUE
Matches all 25 recorded answers
Recorded: 25 workbook cells. How we measure this · See the Rust code
No local names are recorded for this entry.
What it does
FIELDVALUE(value, field_name)
FIELDVALUE reads one named field from a cell holding a linked data type, such as a stock or a geography.
FIELDVALUE(value, field_name)
valueis the cell with the data type.field_nameis the field, as text or from a cell.
=FIELDVALUE(A1,"Price") reads the same field as the dot form =A1.Price. The function form suits formulas where the
field name comes from a cell.
Try it
Quirks
- Microsoft's page says
#FIELD!appears for a field that does not exist, a cell without the data type, or a record lacking that field. - Recorded in Excel 16.0 build 20430:
FIELDVALUEof a number, text, logical, error, blank cell or LAMBDA gives#FIELD!whatever the field name. An error given as the field name is the result. IFERRORaround the call hides blanks, as in Microsoft's own example.
How to implement
Our Rust implements the function's behaviour on the values DNA Calc holds. No value it holds is a linked data type, because
a workbook cell with one is not loaded. So it answers #FIELD! or the argument's error, and the fields themselves are out
of reach until linked data types load.
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.
FIELDVALUE · 1 lines · calc-func/src/catalogue/host_facts.rs on GitHub9 fieldvalue_fn "FIELDVALUE" (2, 2) [V "value", V "field_name"] |s, a, sv| { fieldvalue(s, a) }
fieldvalue · 12 lines · calc-func/src/catalogue/host_facts.rs on GitHub/// FIELDVALUE: #FIELD!, since no value the model holds is a linked data type (see the module
/// documentation), or the error given as the field name. An omitted argument is refused: Excel's
/// result for one is not measured.
fn fieldvalue(site: &Site<'_>, a: &[CalcValue]) -> Step<CalcValue> {
if a.iter().any(CalcValue::is_missing) {
return Err(site.not_modelled(None));
}
match a[1].core_ref() {
CoreRef::Error(code) => fail(code),
_ => fail(WorksheetErrorCode::Field),
}
}
Argument and result plumbing
failcatalogue/kit
No implementation has been published with a Handbook test suite for this function.
Version differences
Answers recorded here come from Excel 16.0 build 20430. No comparison between builds exists.
Alternatives
- The dot form,
=A1.Price. STOCKHISTORYfor past prices.
Named variants
No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents