Data types let one cell hold more than a number or text. For example, an employee with a name, a team, and a start date can fit in a single cell. You can build your own with formulas, and then read and change them with dot functions.
| Data type | What it is | Create it with |
|---|---|---|
| Entity | One value with display text and named fields, so formulas can use the whole thing or any one field. Stock and Geography values, called Linked Data Types, are linked entities whose fields come from an online service. | ENTITY, or Table[#Entities] for every row of a table |
| Formatted number value | A number with a preferred number format. Excel shows that format when the cell's number format is General. | FORMATNUMBER or .SetNumberFormat() |
| Value with metadata | A number, text, or Boolean with fields attached. It behaves like its basic value. | .SetFields() |
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.
Create an entity
- From names and values. For example, =ENTITY("Ada", "Name","Ada", "Team","Design") shows Ada and holds two fields: Name is Ada, and Team is Design. You can also pass a range of names and a range of values. See ENTITY function.
- From a table. For example, =Employees[#Entities] returns one entity for each row of the Employees table. The first column becomes the display text, and every column, including the first, becomes a field. The table stays the source, and if you edit a row, its entity updates. See Using structured references with Excel tables.
When a field comes from a cell that holds a formatted number, it becomes a formatted number value with the cell's format. A price shows as currency, and a date shows as a date, not a number.
See what's inside
Like other Excel data types, an entity has a card that shows all of its fields.
Read a field
Type a period after a reference, and then type the field name.
| Formula | Reads |
|---|---|
| =A2.Team | The Team field |
| =A2.[Start date] | A field whose name contains a space |
| =A2.Lead.Location | A field of an entity held in the Lead field |
| =A2#.Team | The Team field of every entity in a spilled array |
Field names aren't case-sensitive, so =A2.team reads Team.
Use a function to get:
- A field whose name is in a cell, such as B1: =A2.GetFieldValues(B1) or =FIELDVALUE(A2,B1)
- Several fields and their names: =A2.GetFields("Team","Name")
- The names of all fields: =A2.GetFieldNames()
Reading a field that the value doesn't have returns the #FIELD! error. Check first with .HasField(), or wrap the formula in IFERROR.
Change a value with dot functions
To use a dot function, type a period after a value. Excel lists the functions that apply. For example, =A2.SetFields("Team","Research") returns a copy of A2 with a new team.
- Every dot function returns a new value. The original doesn't change. Names such as .SetFields() describe the value you get back, not a change to the cell.
- Chains read left to right. Each dot works on the result so far: =A2.SetFields("Team","Research").SetEntityText("Ada Lovelace").
- A number before the dot needs parentheses. Excel reads 30. as part of the number, so type =(30).SetFields("Unit","g").
- An array of entities works too. For example, =Employees[#Entities].SetFields("Dept","Sales") returns one changed entity for each row.
Fields on numbers, text, and Booleans
.SetFields() also works on a number, text, or Boolean. The result is a value with metadata: it behaves like its basic value and has a card that shows its fields. To list its fields in cells, use .GetFields().
If the first formula is in A2:
| Formula | Result |
|---|---|
| =(30).SetFields("Item","Smoky red sauce", "Unit","g") | 30, with Item and Unit fields |
| =A2+1 | 31, with no fields |
| =ISNUMBER(A2) | TRUE |
Arithmetic uses the basic value, so its result has no fields. To keep the fields, copy them from A2: =(A2+1).SetFields(A2.GetFieldNames(),A2.GetFieldValues()) returns 31 with Item and Unit fields.
Formats and icons that travel with the value
A number format usually belongs to the cell. FORMATNUMBER and .SetNumberFormat() return a formatted number value: a number with a preferred format of its own. .SetIcon() shows an icon with the value.
- Excel shows the preferred format only when the cell's number format is General. If the cell has any other number format, the cell's format shows instead. To check, select the cell and look at Home > Number Format.
- Arithmetic drops the preferred format: if A2 shows 12.50 hours, =A2+1 shows 13.5.
- To remove a format or icon from a value, omit the argument: =A2.SetNumberFormat() or =A2.SetIcon().
Use entities in other functions
Pass whole entities to LAMBDA functions you write, and to MAP, REDUCE, FILTER, and SORTBY. For example, =FILTER(A2#,A2#.HasField("Discount")) keeps only the entities that have a Discount field.
Functions
| Function | What it does |
|---|---|
| ENTITY | Returns an entity with the display text and fields you specify. |
| FORMATNUMBER | Returns a value with the number format you specify. |
Dot functions
| Dot function | What it does |
|---|---|
| .SetFields() | Returns a copy of a value with the modified fields. |
| .RemoveFields() | Returns a copy of a value with fields removed. |
| .SetEntityText() | Returns a copy of an entity with new display text. |
| .GetFields() | Returns a two-column array of field names and their values. |
| .GetFieldNames() | Returns a vertical array of field names. |
| .GetFieldValues() | Returns a vertical array of field values. |
| .HasField() | Returns TRUE if a value has the field you specify, and FALSE otherwise. |
| .SetNumberFormat() | Returns a copy of a value with the number format you specify. |
| .SetIcon() | Returns a copy of a value with the specified icon. |
Tips
- Field order. .GetFieldNames(), .GetFieldValues(), and .GetFields() list all fields in alphabetical order.
- Empty fields. A field whose value comes from an empty cell stays empty: ISBLANK returns TRUE for it. Like a reference to an empty cell, it shows 0 when a formula returns it to the grid.
- Limits. Field names can be up to 255 characters long.
- Text. Joining text to an entity, as in ="Lead: "&A2, returns the #VALUE! error. Join a field instead: ="Lead: "&A2.Name. To join the display text, use VALUETOTEXT: ="Lead: "&VALUETOTEXT(A2) returns Lead: Ada. Comparing an entity with text, as in =A2="Ada", returns FALSE. Compare a field instead: =A2.Name="Ada".
- Sorting. SORT sorts entities by their display text.
- Linked Data Types. Fields you add to a Stock or Geography value stay in the workbook and aren't sent to the data provider. After a refresh, the formula that adds them recalculates, so the result has the refreshed data plus your fields.
- Removing fields. .RemoveFields() doesn't hide data. It returns a copy without those fields, and anyone with the workbook can still read them in the original cell or table.
- Compatibility. Older versions of Excel show these values but don't support dot functions.