SetIcon function

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

Use .SetIcon() to choose the icon a value shows in its cell and on its card. For example, show a person icon on employee entities and a bank icon on accounts, so people can tell them apart at a glance.

.SetIcon() 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

.SetIcon() returns a copy of value that shows the icon you choose, or without its icon if you omit icon_index.

value.SetIcon([icon_index])

Argument Description
value (required) The value before the dot: an entity (including a Linked Data Type such as Stocks), a number, text, or a Boolean, with or without fields. Can be a cell reference, a formula, or an array of values.
icon_index (optional) The number of a built-in icon, from 1 to 550. For example, 328 is Person and 28 is Bank. If you omit it, .SetIcon() removes the value's icon. When value is an array, an array of the same size gives each item its own icon.

Notes

  • When you type the opening parenthesis, Excel lists every icon as "number - name". For the full list, see Icons you can use with SetIcon.
  • A number below 1, or 551 or above, shows the Generic icon (number 1), not an error.
  • Excel ignores the decimal part of icon_index: 3.9 uses icon 3.
  • An icon name as text, such as "Person", returns the #VALUE! error. Use the number instead.
  • Icons come from the built-in set Excel uses for data types. You can't add your own.
  • The value doesn't change: a number stays a number, and its fields and number format stay.
  • When you remove an icon, the value keeps its fields and number format. An entity shows its default icon.
  • To give each row of a table its own icon, keep the icon numbers in a column and pass that column: =Ingredients[#Entities].SetIcon(Ingredients[Icon]).

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

Give an entity an icon, and then remove it.

Field Value
Name Ada
Team Design
Location London
Formula Result
=ENTITY(B2,A2:A4,B2:B4) Ada, with the default entity icon
=A6.SetIcon(328) Ada, with the Person icon
=A7.SetIcon() Ada, with the default entity icon
=A7.Team Design

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.

Three copies of the Ada entity: default icon, Person icon, then default icon again

Example 2

Give each table row its own icon.

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

    Name Price per kg Icon
    Rice 2.5 201
    Olive oil 9.8 165
    Basil 24 259
  2. Enter this formula in E2:

    Formula Result
    =Ingredients[#Entities].SetIcon(Ingredients[Icon]) Rice with the FoodGrains icon, Olive oil with Drop, Basil with LeafTwo (spills into E2:E4)

The Icon column also becomes a field of each entity. To leave it out, use =Ingredients[#Entities].RemoveFields("Icon").SetIcon(Ingredients[Icon]).

Rice, Olive oil, and Basil entities spilled in column E, each with its own icon

Example 3

Add an icon to a formatted number value.

Formula Result
=FORMATNUMBER(12.5,"0.00"" hours""").SetIcon(96) 12.50 hours, with the ClipboardTask icon
=A2+1 13.5

Errors

Error Cause
#VALUE! icon_index is text that isn't a number, such as an icon name.

See also