---
schema_version: "1"
id: a1f9f76b8677b7ec00ce2ed109b7b4878503400fcbf8b9e85db0bb817a0e3900
title: switch
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/sales/264-0-0/spiff_function_ref_switch.md
canonical_url: https://help.salesforce.com/s/articleView?id=sales.spiff_function_ref_switch.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 88facdf3c71a04337622882c97aef743c9d8bd19fd1d223a19fff8c4568c0af6
description: Compares an input value against a list and returns a corresponding value or error message in Salesforce Spiff. This function is similar to the vlookup() function except the lookup tables are specified within the function rather than in a lookup table.
products:
  - Sales Cloud
  - Sales Enablement
release: "264"
---
# switch

Compares an input value against a list and returns a corresponding value or error message in Salesforce Spiff. This function is similar to the `vlookup()` function except the lookup tables are specified within the function rather than in a lookup table.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: both Salesforce Classic (not available in all orgs) and Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available for an additional cost in: <strong>Professional</strong> Edition with Web Services API Enabled</td></tr></tbody></table>

## Syntax

```
switch(value_to_switch, list_of_value_and_result_pairs)
```

## Arguments

  
| Argument | Required? | Description |
| --- | --- | --- |
| lookup\_value | Required | The record or value that you want to compare. |
| list\_of\_value\_and\_result\_pairs | Required | A list of value pairs, where each pair includes a value to match against lookup\_value and a return value for that match. Enclose the list in brackets with comma-separated values. To specify an error message, such as when the list doesn't include lookup\_value, the last item in the list can be a string that you want to show to admins. |

## Example

The Corporate AE Plan has a 10% commission rate and the Enterprise AE Plan has a 12% commission rate. Look up the plan name and apply the appropriate commission rate. Show an error message if the plan name isn't included in the list.

```
=switch(plan.name, ["Corporate AE PLan", "10%", "Enterprise AE Plan", "12%", "We couldn't find a rate for that plan name."])
```