---
schema_version: "1"
id: 0dc63a98e86610999f85dc23e29cc899f576db40f352fbfce577c40b1ef95ae2
title: Sample Financial Calculations 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_financial.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.useful_advanced_formulas_financial.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: d5ec66260233be19e2cb65c7cfca550c013ad87a5ba31394c498aee22d6f09f9
description: Calculate compound interest, consultant costs, gross margin, and contract payments. Other examples supply missing payment due dates and identify overdue unpaid payments.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# Sample Financial Calculations Formulas

Calculate compound interest, consultant costs, gross margin, and contract payments. Other examples supply missing payment due dates and identify overdue unpaid payments.

### 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.").

## Compound Interest

This formula calculates the interest that you have after T years, compounded M times per year.

`Principal__c * ( 1 + Rate__c / M ) ^ ( T * M )`

## Compound Interest Continuous

This formula calculates the interest that will have accumulated after T years, if continuously compounded.

`Principal__c * EXP( Rate__c * T )`

## Consultant Cost

This formula calculates the number of consulting days times 1200 given that this formula field is a currency data type and consulting charges a rate of $1200 per day. Consulting Days is a custom field.

```
Consulting_Days__c *
                    1200
```

## Gross Margin

This formula provides a simple calculation of gross margin. In this formula example, Total Sales and Cost of Goods Sold are custom currency fields.

`Total_Sales__c - Cost_of_Goods_Sold__c`

## Gross Margin Percent

This formula calculates the gross margin based on a margin percent.

`Margin_percent__c * Items_Sold__c * Price_item__c`

## Payment Due Indicator

This formula returns the date five days after the contract start date whenever Payment Due Date is blank. Payment Due Date is a custom date field.

```
( BLANKVALUE( Payment_Due_Date__c, StartDate +5 ) )
```

## Payment Status

This formula determines if the payment due date is past and the payment status is “UNPAID.” If so, it returns the text “PAYMENT OVERDUE” and if not, it leaves the field blank. This example uses a custom date field called Payment Due Date and a text custom field called Payment Status on contracts.

`IF(  AND(Payment_Due_Date__c < TODAY(), ISPICKVAL( Payment_Status__c, "UNPAID" ) ),  "PAYMENT OVERDUE",  null )`