Many people don’t realize that the calculation feature is built into the Gravity Forms core plugin and is available for all license types, including the Basic license.

This is important because calculations allow you to automatically generate dynamic values within a form based on user input.

This adds a power component that will enable you to engage with your users more and potentially build incredible processes like generating invoices.

## Why a BMI Calculator

I am using this as a simple example to demonstrate the potential Gravity Forms offers.

While the most challenging part of this tutorial is getting the formula right, once that is sorted out (provided below), this is a straightforward form to build that could benefit your audience if you’re in the health industry.

## What You’ll Need

You only need to use core functionality to complete this build, so no add-ons are required.

- Gravity Forms (any license)
- The formula (below)

### Optional:

The Gravity Forms calculation feature has some limitations, one being that it doesn’t support advanced mathematical functions.

This means you must do longer math, creating more complex formulas, as demonstrated in this tutorial.

That said, a couple of third party add-ons, listed below, address some of these limitations by adding support for creating more complex formulas.

## Building the Form

To perform a BMI calculation, we must collect specific user information such as weight and height.

This will work with either the metric or imperial systems. But because I was educated in the US, I will be using the imperial system. Math isn’t my strength, so there is no sense in making it harder by trying to use the metric system. 😉

However, you could use the metric system with a minor change to the formula.

### The fields

These are the fields we will need and how they will be used.

- 4 Number fields
- 1. Weight in pounds
- 2. Height Feet
- 3. Height Inches
- 4. BMI Calculation results “Your BMI”

### Making it Work

Of these fields, we only need to configure the fourth one, “Your BMI”. This is where the calculation will happen, and the results will be displayed.

**Step 1: Enable Calculations**

**Step 2: Add your formula**

`(703 * {weight:1}) / ( ( ({feet:3} * 12) + {inches:4} ) * ( ({feet:3} * 12) + {inches:4} ) )`

**Step 3: Set Rounding**

I prefer to round to two decimal places, but you could do zero to give you a whole number.

If you do not set any rounding, your number will be very long, which could confuse the user.

## The BMI Calculation Formula

I wanted to break down the formula to help you understand what is happening so you can modify it if necessary.

`(703 * {weight:1}) / ( ( ({feet:3} * 12) + {inches:4} ) * ( ({feet:3} * 12) + {inches:4} ) )`

Each bracket with the field name (e.g., weight, feet, inches) is the field merge tag. The bracket also includes the field ID number.

You will need to replace these with the merge tags for your specific form. You can do that using the merge tag selector.

### Now, to break down the calculations.

- Convert Height into Inches. Multiply the feet by 12 and add the inches to get the total height in inches.
- Multiply the total height by itself to square it.
- Use the squared height in the denominator for the BMI formula.

This formula multiplies the result by 703 to adjust for the conversion between metric and imperial systems. It bridges the gap between the two unit systems.

By structuring the formula in this way, you’ll bypass the need for the ^ (exponent) function (not supported by the default calculations), and the BMI will be calculated correctly.

## Optional

Using one of the third party add-ons, GP Advanced Calculations or GravityMath, you could use a simpler formula, as shown below.

These add-ons support the use of more advanced functions like the exponent.

`(703 * {weight:1}) / ( ( ({feet:3} * 12) + {inches:4} ) ^ 2 )`

## Gravity Forms BMI Calculation in Action

You might have noticed that there is no submit button on this form. This was intentional.

I used conditional logic to show the button if the “Your BMI” field is empty. Because of the calculation, the field will always have a value, so the button will always be hidden.

## The Wrap Up

Gravity Forms is powerful software for building awesome business tools. This BMI calculator is just an example.

With this BMI calculator, you can provide your website visitors with a tool to improve their health and generate more leads for your business.

If you don’t have a copy of Gravity Forms, you can get one here!

If you need more ideas or help building a calculator, please get in touch with us using the comments or the live chat at the bottom right of the screen.