Use .GetFieldValues() to list the values of every field, or of the fields you name. For example, read a field whose name is in another cell, or total every number in an entity.
.GetFieldValues() is a dot function: you call it on a value by typing a period after the value. For an overview, see Data types and dot functions in Excel.
Note
These features are rolling out to Microsoft 365 Insiders in Beta Channel on Windows Version 2612 (Build 20715.20000) or later and Mac Version 16.117 (Build 26111815) or later, and in Excel for the web.
Syntax
.GetFieldValues() returns a vertical array of field values.
value.GetFieldValues([field_name], ...)
| Argument | Description |
|---|---|
| value (required) | The value before the dot: an entity (including a Linked Data Type such as Stocks), or a number, text, or Boolean that has fields. Can be a cell reference or a formula. With one field_name, it can also be an array of values. |
| field_name (optional) | The name of a field whose value you want, as text or a cell reference. List more names to return more values. If you omit it, .GetFieldValues() returns every value. |
Notes
- With no names, values come back in the same order as .GetFieldNames(): alphabetical by field name. Pass both to .SetFields() to copy fields onto another value. For example, if A2 is a number with fields, =A2+1 drops them, but =(A2+1).SetFields(A2.GetFieldNames(),A2.GetFieldValues()) keeps them.
- With one name, the result is still an array with one row. If the name is fixed, field access is simpler: =A6.Team.
- Use .GetFieldValues() when the field name is in a cell or comes from another formula.
- =FIELDVALUE(A6,A3) also reads a field named in a cell and returns one value. Unlike FIELDVALUE, .GetFieldValues() can read several fields at once and can follow other dot functions.
- With one field name, .GetFieldValues() also works across a spilled array of values, returning one value for each. For example, if a list of entities spills from E2, =E2#.GetFieldValues("Team") returns the Team value of each. For a fixed name, =E2#.Team does the same.
- Field names aren't case-sensitive.
- SUM and other aggregate functions skip text values in the result, so =SUM(A2.GetFieldValues()) totals the numeric fields, as in Example 2.
Examples
Copy the example data and paste it in cell A1 of a new Excel worksheet. If you need to, you can adjust the column widths to see all the data.
Example 1
Read a field whose name is in a cell, and then list every value.
| Field | Value |
|---|---|
| Name | Ada |
| Team | Design |
| Location | London |
| Formula | Result |
| =ENTITY(B2,A2:A4,B2:B4) | Ada |
| =A6.GetFieldValues(A3) | Design |
| =A6.GetFieldValues() | London, Ada, Design (spills into A8:A10) |
A6 uses the ENTITY function to build an employee entity: a value that shows Ada in its cell and holds Name, Team, and Location fields.
A3 holds the text Team, so the formula in A7 reads the Team field. The last formula lists the values in the order Location, Name, Team.
Example 2
Total the numeric fields of an entity.
| Formula | Result |
|---|---|
| =ENTITY("Scores", "Q1",10, "Q2",20, "Note","ok") | Scores |
| =SUM(A2.GetFieldValues()) | 30 |
Errors
| Error | Cause |
|---|---|
| #FIELD! | A name you list isn't a field of value, or value is an entity with no fields. If any name is missing, the whole result is #FIELD!. |
| #VALUE! | value is a number, text, or Boolean with no fields. To skip such values, wrap the formula in IFERROR. |
| #SPILL! | The cells the result spills into aren't empty. |