---
schema_version: "1"
id: 6ca9c59d52831d1e48a194363d1a78382cb410ecbcf1f1f270cfefcff29d6a96
title: Sample Opportunity Management Formulas
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/useful_advanced_formulas_oppty_mgmt.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.useful_advanced_formulas_oppty_mgmt.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: ffdba3153a4988f5ea7d9a8e86a328524e29b9f16887e4b5d9b04e72e4210303
description: Calculate opportunity revenue, costs, pricing, commissions, shipping, and contract value. Other examples categorize opportunities, measure data completeness, format revenue, and link to stage-specific sales documents.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# Sample Opportunity Management Formulas

Calculate opportunity revenue, costs, pricing, commissions, shipping, and contract value. Other examples categorize opportunities, measure data completeness, format revenue, and link to stage-specific sales documents.

### 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: <strong>Essentials</strong>, <strong>Group</strong>, <strong>Professional</strong>, <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</td></tr></tbody></table>

For details about using the functions included in these samples, 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.").

## Expected Product Revenue

This formula calculates total revenue from multiple products, each with a different probability of closing.

`ProductA_probability__c * ProductA_revenue__c + ProductB_probability__c * ProductB_revenue__c`

## Maintenance Calculation

This formula calculates maintenance fees as 20% of license fees per year. Maintenance Years is a custom field on opportunities.

`Amount * Maint_Years__c * 0.2`

## Monthly Subscription-Based Calculated Amounts

This formula calculates an opportunity amount based on a monthly subscription rate multiplied by the subscription period.

`Monthly_Amount__c * Subscription_Months__c`

## Monthly Value

This formula divides total yearly value by 12 months.

`Total_value__c / 12`

## Opportunity Additional Costs

This formula calculates the sum of the product Amount, maintenance amount, and services fees. Maint amount and Service Fees are custom currency fields.

```
Amount + Maint_Amount__c +
                    Services_Amount__c
```

## Opportunity Categorization

This formula uses conditional logic to populate an Opportunity category text field, based on the value of the Amount standard field. Opportunities with amounts less than $1500 are “Category 1,” opportunities with amounts between $1500 and $10,000 are “Category 2,” and the rest are “Category 3.” This example uses nested IF statements.

`IF(Amount < 1500, "Category 1", IF(Amount > 10000, "Category 3", "Category 2"))`

## Opportunity Data Completeness

This formula takes a group of fields and calculates what percent of them are being used by your personnel. This formula field checks five fields to see if they’re blank. If so, a zero is counted for that field. A “1” is counted for any field that contains a value, and this total is divided by five (the number of fields evaluated). This formula requires you to select the **Treat blank fields as blanks** option under Blank Field Handling while the Advanced Formula subtab is showing.

```
(IF(ISBLANK(Maint_Amount__c), 0, 1) + ​
 IF(ISBLANK(Services_Amount__c), 0,1) + ​
  IF(ISBLANK(Discount_Percent__c), 0, 1) + ​
   IF(ISBLANK(Amount), 0, 1) +​
    IF(ISBLANK(Timeline__c), 0, 1)) / 5
```

## Opportunity Expected License Revenue

This formula calculates expected revenue for licenses based on the probability of closing.

`Expected_rev_licenses__c * Probability`

## Opportunity Revenue Text Display

This formula returns the expected revenue amount of an opportunity in text format without a dollar sign. For example, if the Expected Revenue of a campaign is “$200,000,” this formula field displays “200000.”

`TEXT(ExpectedRevenue)`

## Opportunity Total Deal Size

This formula calculates the sum of maintenance and services amounts.

`Amount + Maint_Amount__c + Services_Amount__c`

## Opportunity Total Price Based on Units

This formula generates proposal pricing based on unit price and total volume.

`Unit_price__c * Volume__c * 20`

## Professional Services Calculation

This formula estimates professional service fees at an average loaded rate of $1200 per day. Consulting Days is a custom field on opportunities.

`Consulting_Days__c * 1200`

## Stage-Based Sales Document Selection

This formula Identifies a relevant document in the Documents tab based on opportunity Stage. Use document IDs in the form of “00l30000000j7AO.”

```
CASE(StageName,
"Prospecting", "Insert 1st Document ID",
"Qualification", "Insert 2nd Document ID",
"Needs Analysis", "Insert 3rd Document ID",
"Value Proposition", ...
)
)
```

## Sales Coach

This formula creates a hyperlink that opens a stage-specific document stored in the Documents tab. It uses the previously defined custom formula field that identifies a document based on opportunity Stage. See [Stage-Based Sales Document Selection](https://help.salesforce.com/s/articleView?id=platform.useful_advanced_formulas_oppty_mgmt.htm&release=264.0.0&type=5).

`HYPERLINK("/servlet/servlet.FileDownload?file=" & Relevant_Document__c, "View Document in New Window")`

## Shipping Cost by Weight

This formula calculates postal charges based on weight.

`package_weight__c * cost_lb__c`

## Shipping Cost Percentage

This formula calculates shipping cost as a fraction of total amount.

`Ship_cost__c / total_amount__c`

## Tiered Commission Rates

This formula calculates the 2% commission amount of an opportunity that has a probability of 100%. All other opportunities have a commission value of zero.

`IF(Probability = 1,  ROUND(Amount * 0.02, 2),  0)`

## Total Contract Value from Recurring and Non-Recurring Revenue

This formula calculates both recurring and non-recurring revenue streams over the lifetime of a contract.

`Non_Recurring_Revenue__c + Contract_Length_Months__c * Recurring_Revenue__c`