---
schema_version: "1"
id: 8a7dcde5e0b1ff5a1efa85ba0a326b5008f6f1717e0451a690a3c246c36e2b13
title: Common Formula Errors
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/fixing_formula_errors.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.fixing_formula_errors.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: b48f8d5871f463494ba5cd5eb7c3894aa5a875f04ef23fe9555e71a72d5a6af6
description: Review common errors that can occur with formulas and how to fix them.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# Common Formula Errors

Review common errors that can occur with formulas and how to fix them.

### 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 and Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: all editions</td></tr></tbody></table>

![Tip](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_click-264-0-0-production-enus/5f7d9219-b7b1-4552-8891-f1aba9b289fc/images/icon_tip.png)

Tip Setup with Agentforce can help troubleshoot formulas more efficiently. For more information, see [Setup with Agentforce](https://help.salesforce.com/s/articleView?id=xcloud.setup_agentforce_overview.htm&language=en_US) and [Formulas in Setup with Agentforce](https://help.salesforce.com/s/articleView?id=xcloud.setup_agentforce_formula.htm&language=en_US).

- “#Error!” displays for a formula field whenever an error occurs while calculating the value of a formula. To resolve the error, check your formula.
    - Is the formula dividing by zero? If so, check if the denominator of your expression is zero and provide an alternative value. For example, the following campaign formula field is blank if the number of opportunities is zero:
        
        ```
        IF(NumberOfOpportunities > 0, 
          NumberOfWonOpportunities / NumberOfOpportunities, null)
        ```
    - Is the formula calculating a value larger than the maximum value of the current type? If so, you can append L to numeric values to make them Long so the intermediate products will be Long and no overflow occurs. For example, the following example shows how to correctly compute the amount of milliseconds in a year by multiplying Long numeric values.
        
        ```
        Long MillsPerYear = 365L * 24L * 60L * 60L * 1000L;
                                                                Long ExpectedValue = 31536000000L;
                                                                System.assertEquals(MillsPerYear, ExpectedValue);
        ```
    - Is the formula calculating the square root of a negative number? If so, use an IF function similar to the one above to check if the value is a positive number.
    - Is the formula calculating the LOG of a negative number? If so, use an IF function similar to the one above to make sure that the number is positive.
    - Is the formula using the VALUE function with text that contains special characters? For examples of special characters, see [Formula Operators and Functions](https://help.salesforce.com/s/articleView?id=platform.customize_functions.htm&release=264.0.0&type=5 "Use these operators and functions when building formulas. All functions are available everywhere that you can include a formula, such as formula fields, validation rules, approval processes, and workflow rules, unless otherwise specified.").
    - Make sure the formula does not contain a HYPERLINK function within a text function, such as `LEFT( HYPERLINK("http://MYCOMPANY.ORG ", "MYCOMPANY ") , 5)`.
    - Is the formula disabled or referencing a disabled formula field? Salesforce disables formula fields when they are deleted and they remain disabled after they are restored. To enable disabled formula fields, edit and save the field. For more information on deleted custom fields and restoring them, see [Manage Deleted Custom Fields](https://help.salesforce.com/s/articleView?id=platform.fields_managing_deleted_fields.htm&release=264.0.0&type=5 "Deleted custom fields and their data are stored until your org permanently deletes them or 15 days have elapsed, whichever happens first. Until that time, you can restore the field and its data.").
- “#Too Big!” displays if your formula output is over 18 digits. When this happens, check your formula for calculations that could result in more than 18 digits. Avoid multiplying large numbers, raising a large number to a power, or dividing by a very small number.
- CASE functions return an error whenever any of the expressions return an error, regardless of which one should be returned. For example, `CASE(Field__c,"Partner", "P",​ "Customer", "C", LEFT(Field__c, -5))` returns an error even if the value of the field is “Partner” or “Customer” because the last statement is illogical.
- Prevent division by zero errors by including an IF function that determines if the value of a field is zero. For example, `IF(Field__c =0,0, 25/Field__c)`.