Use the [frmmath] shortcode to calculate the value of a math expression. Place the math expression inside the frmmath shortcode and the result of the calculation will be displayed. For example, this will display the result of subtracting one stat from another:
[frmmath] [frmstats id=67 type=total]  [frmstats id=42 type=total] [/frmmath]
This shortcode is used with static values and values that have already been saved in a form. If you are looking for calculations that change while the form is filled out, see form field calculations.
Values
The math expression can contain numbers and other shortcodes (like the frmstats shortcode). In a View, email, or success message, field shortcodes like [100] can also be included.
Operators
A math expression can use addition (+), subtraction (), multiplication (*), mod (%), and division (/). Parentheses can also be included. They can be nested, e.g.
[frmmath] (1 + (3 * 3)) / 2 [/frmmath] Result: 5
Where can the math functions be used?
The [frmmath] shortcode can be used in a View, directly on a page, in an email, as a default value, or anywhere else that WordPress shortcodes are processed.
Parameters
 error  the content to display if there's an error in the math expression.
 error=debug  The math expression will be displayed, as it appears after shortcodes inside it are processed. You can use this to help determine why the error occurred. Only use error=debug during development and testing, not when the content is live.
 error="content of your choosing"  The value set for the error parameter will be displayed. Suggested values: a default number (e.g. 0), a message, or nothing. The default is to display nothing.
Read more about math errors.
 clean  Determines whether the math expression should be cleaned of nonmath characters.
 clean=1  All content that doesn't belong in a math formula, like text, punctuation marks, and currency symbols, is removed. This removal happens after shortcodes have been processed, just before the math expression is evaluated.
 clean=0  The math expression remains as it is after shortcodes have been processed. This is the default.
 thousands_sep  character used to separate thousands.
 decimal  number of decimal places.
 dec_point  character used for decimal point.
Using math in a conditional
If you'd like to display content conditionally based on the result of a [frmmath] calculation, you can use the following approaches.
Use math directly in a conditional
If you want to display the content in a View and your math expression has only field shortcodes (e.g. [100]) and set numbers (e.g. 10), you can use the [frmmath] shortcode directly with the frmcondition shortcode. Include source=frmmath and put the math expression in the content param. For example, to multiply two field values, use the following approach:
[frmcondition source=frmmath content="[100] * [102]" greater_than=10]content if the result is greater than 10[/frmcondition]
Save the math value in a param
For math expressions that use standard WordPress shortcodes, like frmstats and frmfieldvalue, you can use [frmsetget] to save the result of [frmmath] in a param. Then you can use the param with [frmcondition].
For example, an event has space for 100 people. The stat for the number of spaces already taken is: [frmstats id=18 type=count].
You can calculate the remaining spaces for the event and save the value in a parameter:
[frmsetget param=remaining_spaces] [frmmath] 100  [frmstats id=18 type=count] [/frmmath] [/frmsetget]
You can then show content conditionally based on the number of remaining spaces.
[frmcondition source=param param=remaining_spaces greater_than=0 less_than=10] If you want to attend, sign up now! There are fewer than ten spaces remaining.[/frmcondition]
[frmcondition source=param param=remaining_spaces less_than_or_equal_to=0]Sorry! We're fully booked this year. We hope you can join us next year.[/frmcondition]
Errors
If the content inside the [frmmath] shortcode isn't a proper math expression, the value in the error param will be displayed.
Any of the following in the math expression will cause an error:
 letters, punctuation (other than commas and periods), or other nonmath characters, like $
 unmatched parens
 missing or empty values, e.g. 3 + * 2
Note: Empty content isn't considered an error.
How the math is evaluated
The math expression is evaluated following a standard PEMDAS style approach:

 parentheses are evaluated first,
 then multiplication, mod, and division (left to right),
 then addition and subtraction (left to right).
You can read more about this approach at https://www.mathsisfun.com/operationorderpemdas.html
Examples
Average test score
In a View, show the average test score of each student by adding the scores from three different forms and dividing by three. The student id in the form used for the view is in field 42. Fields 100, 150, and 165 hold the student test scores. Fields 101, 151, and 165 hold the student ids. Each of the three forms limits entries to one per user.
[frmmath] ([frmstats id=100 101=[42] type=total] + [frmstats id=150 151=[42] type=total] + [frmstats id=160 165=[42] type=total])/3 [/frmmath]
Stat with filters combined with OR
The stats shortcode can give you the number of gold members and, separately, the number of bronze members. If you want the total number of members who have either the gold or bronze level, you can use the math shortcode to combine the two stats. Field 25 holds the membership level.
[frmmath] [frmstats id=25 25="bronze" type=count] + [frmstats id=25 25="gold" type=count] [/frmmath]
Show content if a user filled out one of two forms
Show content if a user has filled out at least one of two forms. Field 70 is a field in Form A, and field 80 is a field in Form B.
First, use math to determine how many times the user has filled out both forms and save the result in a param.
[frmsetget param="forms_total"] [frmmath] [frmstats id=70 user_id=current type=count] + [frmstats id=80 user_id=current type=count] [/frmmath] [/frmsetget]
Then use the result in a conditional.
[frmcondition source=param param=forms_total greater_than=0] content you want to display [/frmcondition]
Show incremental content
In the content box in a view, you may show incremental content. This example will show the content on every 3rd entry show in the view. This count resets each time the page is changed.
[frmcondition source=frmmath content="[entry_position] % 3" equals="0"]This is the incremental content[/frmcondition]
Add values from Views which may have no entries
You may want to combine the values of several Views, each of which displays one number, which may also display the no entries message. Since [frmmath] requires a properly formatted math expression, it wouldn't work properly with a View that displays the no entries message. To get around this, you can use [frmcondition] to only display Views when they have values.
 Begin your math expression with a value. It could be a field value, a fixed value (like 100), or a shortcode that results in a value. If you don't have anything like that naturally, you would use 0.
 In each View, put "none" in the no entries message box.
 For each View you want to add, create a conditional to test if the value of the View is not like "none". Put + and the View shortcode inside [frmcondition].
[frmcondition source=displayfrmdata id=42 not_like="none"] + [displayfrmdata id=42 filter=limited][/frmcondition]
 The full math expression for adding two Views could look something like this:
[frmmath] 0 [frmcondition source=displayfrmdata id=42 not_like="none"] + [displayfrmdata id=42 filter=limited][/frmcondition][frmcondition source=displayfrmdata id=36 not_like="none"] + [displayfrmdata id=36 filter=limited][/frmcondition][/frmmath]
Much appreciation to Andrew Klimek
The clever idea of creating a math shortcode came from Andrew Klimek. The code he kindly shared was the inspiration for the [frmmath] shortcode. Many thanks, Andrew!