SetEntityText function

Applies To
Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web

Use .SetEntityText() to change the text an entity shows in its cell. For example, show Ada Lovelace while the Name field stays Ada.

.SetEntityText() is a dot function: you call it on a value by typing a period after the value. It returns a new value and leaves the original unchanged. 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

.SetEntityText() returns a copy of value with new display text.

value.SetEntityText(text)

Argument Description
value (required) The value before the dot: an entity you built, for example with ENTITY or Table[#Entities]. Can be a cell reference, a formula, or an array of entities.
text (required) The text to show in the cell. A number becomes text. When value is an array, an array of the same size gives each item its own text.

Notes

  • The fields don't change, including any field that holds the same text, such as Name.
  • .SetEntityText() works only on entities you build. On a Stock or Geography value, or on a number, text, or Boolean with or without fields, it returns the #VALUE! error.
  • Table[#Entities] uses each row's first column as the display text. To show a different column, pass that column: =Employees[#Entities].SetEntityText(Employees[Full name]).
  • Chain .SetEntityText() after other dot functions to label the result: =A6.SetFields("Team","Research").SetEntityText("Ada Lovelace").
  • Empty text ("") leaves the cell showing nothing; the fields remain.
  • To use the display text inside a longer string, use VALUETOTEXT: ="Lead: "&VALUETOTEXT(A7) returns Lead: Ada Lovelace. Joining the entity itself, as in ="Lead: "&A7, returns the #VALUE! error.
  • To change fields, use .SetFields().

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

Change the display text and keep the fields.

Field Value
Name Ada
Team Design
Location London
Formula Result
=ENTITY(B2,A2:A4,B2:B4) Ada
=A6.SetEntityText("Ada Lovelace") Ada Lovelace
=A7.Name Ada

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.

The Ada entity in A6 and a copy in A7 that shows Ada Lovelace, with the Name field still Ada

Example 2

Change a field and the display text in one formula. Continuing from Example 1, enter these formulas in A9 and A10:

Formula Result
=A6.SetFields("Team","Research").SetEntityText("Ada Lovelace") Ada Lovelace
=A9.Team Research

Example 3

Label each table row with the value from another column.

  1. Paste this data in cell A1 of a new worksheet, select A1:C3, and then use Ctrl+T to create a table. Name the table Employees (Table Design > Table Name).

    Name Team Full name
    Ada Design Ada Lovelace
    Grace Research Grace Hopper
  2. Enter this formula in E2:

    Formula Result
    =Employees[#Entities].SetEntityText(Employees[Full name]) Ada Lovelace, Grace Hopper (spills into E2:E3)

Errors

Error Cause
#VALUE! value isn't an entity, or it's a Stock or Geography value.

See also