---
url: /excel-addin/selectionset.md
description: Set the selected element for a dimension of a workview.
---

# SelectionSet

::: tip Consider SetInstruction
[SetInstruction](/excel-addin/setinstruction) is recommended instead, as it lets users generate their own selections.
:::

Set the selected element for a dimension of a workview.

```js
SelectionSet(modelId, applicationId, workviewId, dimension, selection)
```

#### Parameters

* `modelId` - The ID of the model.
* `applicationId` - The ID of the application.
* `workviewId` - The ID of the workview.
* `dimension` - The dimension whose selection will be set.
* `selection` - The element to select.

::: warning IDs, not names
Unlike the other MODLR Excel Add-in functions, the first three parameters of SelectionSet are **IDs**, not names.
:::

#### Example

```js
SelectionSet(modelId, applicationId, workviewId, "Time", "2022 - Annual")
```

The cell returns the selection text, in this case "2022 - Annual".
