---
title: "GravityMath Calculation field"
date: 2026-04-23
author: "GravityKit"
link: "https://www.gravitykit.com/docs/gravitymath/gravitymath-calculation-field/"
---

The GravityMath Calculation field allows you to display calculated values in your Views with professional formatting options. Perform mathematical operations on form field values and present the results as numbers, currency, or percentages.

## Table of contents

- [Overview](#overview--fzlj)
- [Field settings](#field-settings-0ktbu)
    - [Formula](#formula-qxoae)
    - [Number Format](#number-format-rdz4o)
    - [Decimal Places](#decimal-places-mu-h0)
    - [Show Thousands Separator](#show-thousands-separator-t7xgm)
    - [Prefix](#prefix--z2kb8)
    - [Suffix](#suffix-y1epw)

- [Examples](#examples-e_tey)
- [FAQ](#faq-cddur)
- [Screenshots](#screenshots-pbhrf)

---

## Overview

The Calculation field is powered by GravityMath and integrates seamlessly with GravityView. It performs **entry-scoped calculations**—calculating values based on fields within a single entry. It enables you to:

- Create dynamic calculations using form field values from the current entry
- Format results as numbers, currency, or percentages
- Apply number formatting with proper locale support

💡 For calculations across multiple entries (like totals or averages of all visible entries), use the [Custom Content field with GravityMath shortcodes](https://www.gravitykit.com/docs/gravitymath/calculations-in-gravityview/) instead.

**How to add the field:**

When configuring your View, the Calculation field is available [when adding a field](https://www.gravitykit.com/docs/gravityview/getting-started-gravityview/getting-started-adding-fields-to-the-multiple-entries-and-single-entry-pages/). The field will be named **Calculation** in the field picker:

![A screenshot of the field picker with the GravityMath Calculation field shown, with](https://www.gravitykit.com/wp-content/uploads/2026/04/AagkSb.png)---

## Field settings

### Formula

The formula defines the mathematical calculation to perform on the **current entry**. You can use merge tags to reference form field values from the entry and apply mathematical operations.

The Calculation field performs **entry-scoped calculations**—it calculates values based only on fields within a single entry, not across multiple entries. For calculations across multiple entries (like sums or averages of all visible entries), use the [Custom Content field with GravityMath shortcodes](https://www.gravitykit.com/docs/gravitymath/calculations-in-gravityview/).

All the formula syntax available [in the GravityMath shortcode](https://www.gravitykit.com/docs/gravitymath/math-shortcode/) is available in the Calculation field.

#### Syntax

Use standard mathematical operators:

- `+` Addition
- `-` Subtraction
- `*` Multiplication
- `/` Division
- `^` Exponentiation
- `%` Modulo
- Parentheses `()` for operation order

#### Merge tags

**Merge tags** are placeholders that dynamically pull values from form fields. You can use Gravity Forms merge tags to include values from other fields in an entry (e.g., `{Field:1}` references the value of field #1).

#### Shortcodes

Short codes are not allowed in the formula. If you need to use a shortcode, you can use the [GravityMath shortcode](https://www.gravitykit.com/docs/gravitymath/math-shortcode/) with a Custom Content field instead.

#### Examples

**Basic arithmetic:** `{Field:1} + {Field:2}`

**Calculate percentage:** `({Field:1} / {Field:2}) * 100`

**Complex formula with order of operations:** `({Field:1} * 1.0825) + ({Field:2} - {Field:3})`

**Calculate average:** `({Field:1} + {Field:2} + {Field:3}) / 3`

**Tax calculation:** `{Field:1} * 1.0825 `

**Discount calculation:** `{Field:1} * (1 - ({Field:2} / 100))`

#### Learn More

For advanced formula syntax and functions, see the [GravityMath shortcode documentation](https://www.gravitykit.com/docs/gravitymath/math-shortcode/#all-supported-functions).

---

### Number Format

Controls how the calculated result is formatted. The **Number Format** dropdown includes non-currency formats and all currencies supported by Gravity Forms.

#### Options

**Non-Currency Formats:**

- **Number** - Plain number without formatting
- Example: `1234.56`
- **Currency** - A number that represents a price
- Example: `$1,234.56`
- **Percent** - Displays value with percent symbol
- Example: `45.5%`

**Currency Formats:**

All [currencies supported by Gravity Forms](https://docs.gravityforms.com/gform_currencies/) are available.

Each currency automatically applies the correct:

- Currency symbol position (before or after the amount)
- Decimal separator (`.` or `,` )
- Thousands separator (`,` , `.` , space, or apostrophe)
- Number of decimal places (e.g., JPY has 0 decimals)

#### Examples

**USD formatting:** `$1,234.56`

**EUR formatting:** `1.234,56 €`

**GBP formatting:** `£ 1,234.56`

**JPY formatting:** `¥ 1,235`

#### Notes

- Currency formatting respects the locale-specific conventions of each currency
- Custom currencies added via the `gform_currencies` filter are automatically included
- When using currency format, the **Decimal Places** setting may be overridden by the currency's default decimal configuration

---

### Decimal Places

Specifies how many decimal places to display in the result.

#### Options

- **Default** - Uses 2 decimal places for most formats
- 0 - No decimal places (rounds to integer values)
- **1–5** - The number of decimal places displayed

#### Examples

**Value: 123.456789**

- Default: `123.46`
- 0 decimals: `123`
- 1 decimal: `123.5`
- 3 decimals: `123.457`
- 5 decimals: `123.45679`

#### Notes

- Values are rounded, not truncated
- For currency formats, some currencies may override this setting (e.g., JPY always uses 0 decimals)
- Applies to **Number**, **Formatted Number**, and **Percent** formats

---

### Show Thousands Separator

**Type**: Checkbox

**Default**: Checked (enabled)

**Visibility**: Hidden when **Number Format** = **Currency**

Controls whether to include thousands separators (commas or locale-appropriate separator) in the formatted number.

#### When enabled (default)

Large numbers include separators for readability:

- `1000` displays as `1,000`
- `1000000` displays as `1,000,000`

#### When disabled

Numbers display without separators:

- `1000` displays as `1000`
- `1000000` displays as `1000000`

#### Notes

- Uses locale-aware separators (e.g., `.` in some European locales, `,` in US)
- This setting is hidden when using Currency format (currencies control their own separators)
- Only affects Number format

---

### Prefix

**Default**: *Empty*

Text to display before the calculated number.

#### Use cases

**Unit labels:**

- Prefix: "Score: "

Result: `Score: 87.5`

**Labels:**

- Prefix: "Total: "

Result: `Total: 1,234`

**Custom indicators:**

- Prefix: "Remaining: "

Result: `Remaining: 23`

#### Examples

**Sales commission with label:**

- Formula: `{Sales:5} * 0.15`
- Number Format: Currency
- Currency: USD
- Prefix: "Commission: "

Result: `Commission: $1,875.00`

**Score with label:**

- Formula: `({Test 1:10} + {Test 2:11}) / 2`
- Number Format: Number
- Decimals: 1
- Prefix: "Average: "

Result: `Average: 87.5`

#### Notes

- Prefix appears before currency symbols when using Currency format
- Can include HTML for styling (e.g., **`Total:`** )
- Supports merge tags for dynamic prefixes

---

### Suffix

**Default**: *Empty*

Text to display after the calculated number.

#### Use cases

**Unit labels:**

- Suffix: " points"

Result: `87.5 points`

**Percentage indicators:**

- Suffix: "%"

Result`85%`

**Custom units:**

- Suffix: " hours"

Result: `4.5 hours`

**Completion labels:**

- Suffix: " completed"

Result: `15 completed`

#### Examples

**Completion rate with percentage:**

- Formula: `({Completed:5} / {Total:6}) * 100`
- Number Format: Number
- Decimals: 1
- Suffix: "%"

Result: `75.0%`

**Response time in hours:**

- Formula: `{Response Time Minutes:8} / 60`
- Number Format: Number
- Decimals: 2
- Suffix: " hrs"

Result: `4.50 hrs`

**Items completed:**

- Formula: `{Completed Tasks:5}`
- Number Format: Number
- Decimals: 0
- Suffix: " of {Total Tasks:6} completed"

Result: `15 of 20 completed`

#### Notes

- Suffix appears after currency symbols and amounts when using Currency format
- Can include HTML for styling (e.g., *` remaining`* )
- Supports merge tags for dynamic suffixes (e.g., ` of {Field:6} total` )

---

## Examples

### Sales tax calculator

**Scenario:** Calculate and display sales tax on a purchase.

**Settings:**

- Formula: `{Subtotal:15} * 0.0825`
- Number Format: USD
- Decimal Places: 2
- Show As: Number

**Result:** For a subtotal with a value of $125.00, the output will be `$10.31`

---

### Multi-field average score

**Scenario:** Calculate average of multiple test scores.

**Settings:**

- Formula: `({Test 1:10} + {Test 2:11} + {Test 3:12} + {Test 4:13}) / 4`
- Number Format: Number
- Decimal Places: 1
- Show As: Number

**Result:** `87.5 `

---

### Discount calculator

**Scenario:** Calculate final price after discount percentage.

**Settings:**

- Formula: `{Original Price:5} * (1 - ({Discount Percent:6} / 100))`
- Number Format: USD
- Decimal Places: 2
- Show As: Number

**Input:**

- Original Price: $200.00
- Discount: 15%

**Result:** `$170.00 `

---

## FAQ

### Can I use conditional logic to show different calculations?

The Calculation field doesn't support conditional logic within formulas. However, you have two options:

**Option 1 - Multiple Calculation Fields with Conditional Visibility:**

Create multiple Calculation fields with different formulas, then use [Field Conditional Logic](https://www.gravitykit.com/docs/gravityview-pro/advanced-filter/field-conditional-logic/) to show/hide each field based on conditions.

**Option 2 - Custom Content Field with GravityMath:**

For more complex conditional calculations, use a [Custom Content field with GravityMath shortcodes](https://www.gravitykit.com/docs/gravitymath/how-to-calculate-the-sum-of-a-field-in-gravity-forms/) to build conditional logic into your output.

### What happens if a merge tag field is empty?

Empty fields are treated as zero (0) in calculations. Ensure your formula handles potential zero values appropriately.

### Can I combine multiple currencies?

While you can calculate with values from multiple currency fields, the **Number Format** setting determines the display currency. All values in the formula are treated as numeric values regardless of their original currency.

### How do I round to the nearest whole number?

Set **Decimal Places** to 0. The value will be rounded (not truncated) to the nearest whole number.

### What's the difference between "Number" and "Formatted number with thousands separators"?

- **Number**: `1234.56` (no thousands separator)
- **Formatted number**: `1,234.56` (includes thousands separator)

### Can I hide the calculation from certain users?

Use GravityView's standard field Visibility settings (for example, "Make visible only to logged-in users?" and [field conditional logic](https://www.gravitykit.com/docs/gravityview-pro/advanced-filter/field-conditional-logic/)) to control who can see the calculation.

### How do I calculate percentages?

**Method 1 - Display as Percent:**

- Formula: `({Field:1} / {Field:2}) * 100`
- Number Format: Percent

### Can I reference calculations in other fields?

No, calculations are performed at display time and cannot be referenced by other fields. Each Calculation field operates independently.

### Can I calculate totals or averages across multiple entries?

No, the Calculation field is **entry-scoped**—it only performs calculations on fields within a single entry.

To calculate across multiple entries (like sum, average, min, max of all visible entries), use the [Custom Content field with GravityMath shortcodes](https://www.gravitykit.com/docs/gravitymath/calculations-in-gravityview/) with `scope="visible"` or `scope="form"` .

### What if my formula has an error?

If the formula cannot be evaluated, the field will display nothing to site visitors. The error is logged for administrators to review.

**To troubleshoot:**

- Enable logging in [GravityKit Settings](https://www.gravitykit.com/docs/gravityview/advanced/gravityview-logging-tools/)
- Reload the page to trigger the error
- Check the error logs to review the error message

**Common causes:**

- Check your formula syntax for mathematical errors
- Ensure all referenced fields exist and contain numeric values
- Verify merge tags are formatted correctly (e.g., `{Field:1}` )

**Common formula errors:**

- Division by zero
- Invalid merge tag references
- Non-numeric field values
- Mismatched parentheses

### How do I format large numbers?

Use the "Formatted number with thousands separators" option: `1000000` becomes `1,000,000`

For currency formatting, large numbers are automatically formatted according to the selected currency's locale.

### How do I calculate percentages?

Calculate the percentage in your formula and use a suffix to add the percent symbol:

- Formula: `({Field:1} / {Field:2}) * 100`
- Number Format: Number
- Decimals: 1
- Suffix: "%"

This gives you full control over decimal places while displaying the result as a percentage.

---

## Screenshots

![Calculation settings window with formula, currency, and number format options](https://www.gravitykit.com/wp-content/uploads/2025/10/file-6yzLwEcOpR.png)
*Configuration of a Calculations field![Cost of $28,382 displayed, owed on arrival](https://www.gravitykit.com/wp-content/uploads/2025/10/file-7x9jK6WjFv.png)Sample output from the Calculations field*