Dynamic Formulas allow you to insert Excel's formulas into cells even when the formula must reference rows that will be inserted later during the merge process. They can repeat for each inserted row or use only the cell where the field is placed.
Dynamic Formulas begin with &== and are followed by an Excel formula.
Repeating Dynamic Formulas begin with &=&= and are followed by an Excel formula.
You may use most of Excel’s functions in a Dynamic Formula. The following parameters apply to Dynamic Formulas.
PARAMETER | DESCRIPTION |
---|
{r} | Indicates to use the current row number
Used in conjunction with a column letter to indicate a cell on the current row. When the following is placed in cell C1: &==A{r}*B{r} results in the formula =A1*B1 |
{integer} | Offset to current row number, where integer is a positive or negative number that represents the number of rows above or below the current row. Used in conjunction with a column letter to indicate a particular cell offset by the number of rows indicated by the integer. {2} would mean to reference a cell two rows below the current row {-1} would mean to reference a cell one row above the current row When placed in cell A10: &==E{1}*D{1} results in the formula =E11*D11 |
Example 1:
Say we’re creating a quote using Opportunities with Opportunity Line Items and we’d like to do some of the math for each Line Item in Excel. (This example is purely academic – Salesforce already computes the product for you.)
We’ll start with a Template Builder window that looks like this:
![](/composer/files/202407.1.4/salesforce/176293363/176293358/1/1644495063737/df1.png)
We’ll create a template that includes a Dynamic Formula to find the product of the price multiplied by the quantity.
![](/composer/files/202407.1.4/salesforce/176293363/176293359/1/1644495063727/df2.png)
The output from this merge would look like this:
![](/composer/files/202407.1.4/salesforce/176293363/176293360/1/1644495063718/df3.png)
In this case, the total does not repeat for each row. If you want it to repeat, use a Repeating Dynamic Formula as shown next.
Example 2:
Let’s extend the previous example by changing the Dynamic Formula to a Repeating Dynamic Formula.
Here’s the modified template:
![](/composer/files/202407.1.4/salesforce/176293363/176293361/1/1644495063707/df4.png)
The output from this merge would look like this:
![](/composer/files/202407.1.4/salesforce/176293363/176293362/1/1644495063635/df5.png)