Newer Version Available

This content describes an older version of this product. View Latest

Sample Financial Calculations Formulas

Use these formulas for financial calculations.
Available in: both Salesforce Classic and Lightning Experience
Available in: All Editions

For details about using the functions included in these samples, see Formula Operators and Functions.

Compound Interest

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

1Principal__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.

1Principal__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.

1Consulting_Days__c *
2                    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.

1Total_Sales__c - Cost_of_Goods_Sold__c

Gross Margin Percent

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

1Margin_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.

1(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.

1IF( 
2AND(Payment_Due_Date__c < TODAY(),
3ISPICKVAL(Payment_Status__c, "UNPAID")), 
4"PAYMENT OVERDUE", 
5null )