Add, subtract, multiply, and divide values
When designing a form, you can create a formula that calculates values in text boxes, rich text boxes, date pickers, and expression boxes. Because expression boxes only display data and do not store it, you should use an expression box only if you do not want to use the calculated value in another calculation or save it as part of your form.
Formulas are stored in fields and are displayed in the controls that are bound to those fields.
- In design mode, double-click the control where you want to create the formula.
- On the Data tab of the Control Properties dialog box, click Insert Formula .
Note To create the formula by using the field's properties, right-click the field in the Data Source task pane, and then click Properties on the shortcut menu.
- In the Insert Formula dialog box, click Insert Field or Group.
- In the Select a Field or Group dialog box, click the field whose value you want to include in the formula, and then click OK.
- After the field in the Formula box in the Insert Formula dialog box, type the symbol for the mathematical operation that you want. The symbols are shown in the following table (note that you should include spaces around the division symbol).
Operation Symbol Add + Subtract - Multiply * Divide / - To add the second value to your formula, click Insert Field or Group.
- In the Select a Field or Group dialog box, click the field whose value you want to include.
Notes
- To create more complicated formulas, you can repeat steps 3 and 4, include functions, and use parentheses.
- To add the values in a repeating field, use the sum function.
- The information in this topic may not apply if you are working with a form designed using Microsoft Office InfoPath 2003 without the service pack installed. Learn more