---
schema_version: "1"
id: 106993f6ffd23fe913c81e9f77bf8ddef6c93aceb6b857ef78fb978abcde02bd
title: iferror
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/sales/264-0-0/spiff_function_ref_iferror.md
canonical_url: https://help.salesforce.com/s/articleView?id=sales.spiff_function_ref_iferror.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: c3a8aa99df8edfe1fdb264905c2d89e2970734fbd3e8ecc7e74c5c6c3d8efa5b
description: Checks whether an expression results in an error or null value in Salesforce Spiff and either returns the result of the expression or returns a default value for error handling. This function provides an alternative nested if() statements, but this function can also disguise real errors and result in inaccurate calculations if not used carefully.
products:
  - Sales Cloud
  - Sales Enablement
release: "264"
---
# iferror

Checks whether an expression results in an error or null value in Salesforce Spiff and either returns the result of the expression or returns a default value for error handling. This function provides an alternative nested `if()` statements, but this function can also disguise real errors and result in inaccurate calculations if not used carefully.

### 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

```
iferror(expression, error_expression)
```

## Arguments

  
| Argument | Required? | Description |
| --- | --- | --- |
| expression | Required | The condition to test. |
| error\_expression | Required | The error handling to execute when the expression results in an error or null value. |

## Considerations

![Important](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-sales-sales_performance_management-264-0-0-production-enus/b1f2feb4-26b8-444f-97f7-be2349869d93/images/icon_important.png)

Important Don't use this function if you can't diagnose the source of an error.

This function doesn't discriminate which errors to handle. For example, maybe you're trying to prevent a divide-by-zero error for this formula.

```
if(DenominatorField = 0, 0, DivisionCalculation)
```

When you use `iferror(DivisionCalculation, 0)`, an error can occur in the numerator, denominator, or any part of the calculation. Each error returns `0` with no error message.

The `iferror()` function also breaks the trace. If the `if(DenominatorField = 0, 0, DivisionCalculation)` expression includes ARR divided by quota, attainment appears as `0` on the statement and ARR and quota appears as `0` or not a number for the record. When you specify a divide-by-zero check, you see the values for ARR and quota if they exist.

## Example

A rep has a custom rate assigned by a quota table, and you want to check whether the rate for a rep is empty. If so, prompt the admin to specify a rate for the rep. For the expression to test, calculate the rep's rate. For the error\_expression argument, use the `error()` function to show a message for resolving the error condition.

```
=iferror(DealMRR * AESpecialRates, error(concat(["Enter rates for", rep.name, "on the AESpecialRates quota page."])))
```

![Tip](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-sales-sales_performance_management-264-0-0-production-enus/b1f2feb4-26b8-444f-97f7-be2349869d93/images/icon_tip.png)

Tip The `iferror()` function is helpful when you're creating calculations and want to test for missing logic or variables. To prevent errors in production logic, use the `iferror()` function only during development and testing.

#### See Also

- [error](https://help.salesforce.com/s/articleView?id=sales.spiff_function_ref_error.htm&release=264.0.0&type=5 "Returns a custom message for a statement calculation error in Salesforce Spiff. This function stops statement calculations and helps you alert admins that information is missing or preventing the calculation from executing.")
- [if](https://help.salesforce.com/s/articleView?id=sales.spiff_function_ref_if.htm&release=264.0.0&type=5 "Tests for a condition in Salesforce Spiff and returns different values depending on the outcome.")