Rounding numbers in Gravity Forms (2024)

Tutorials » GravityWP BV » Rounding numbers in Gravity Forms

Do you want more options to round numbers in Gravity Forms Number Fields and calculations? And decide in which direction to round the number, like rounding up (ceil), rounding down (floor) or automatically (round up or down dependend on the value you want to round)? With the GravityWP – Advanced Number Field that’s as easy as it gets.

Get Advanced Number Field

Rounding up to 5 decimal places

With Advanced Number Field enabled, you can easily select a checkbox in your Field Settings of the Gravity Forms Number Field you want to round. Two extra options appear:

  • Rounding to decimal places: you can select up to 5 decimal places to round.
  • Rounding method: Round (up or down depending on the value), Ceil (rounding up), Floor (rounding down)
Rounding numbers in Gravity Forms (1)

Using rounding on calculations

You can also activate rounding on calculations. Make a calculations like you are used to, using Merge Tags with number values and select ‘Round the Value’ to automatically round the outcome of the calculation.

Rounding numbers in Gravity Forms (2)

Use in combination with custom units

You can use the rounding option in combination with custom units like square or cubic meters (m2, m3), the percentage sign (%), degrees Celcius or Fahrenheid (°C, °F), Irradiance (W/m2) or another custom unit.

Check out the Tutorial about Custom Units for Gravity Forms Number Fields.

Rounding numbers in Gravity Forms (3)

Rounding without add-on

You can read on the Gravity Forms community forum more about rounding without an add-on. This is no standard functionality in Gravity Forms for rounding, but with custom JavaScript/jQuery you can program your own solution if you want the rounding to happen in real time.

If real-time rounding is not necessary, you can also use the gform_field_validation filter to check the entered value or the gform_pre_submission filter to change the value after submission. Read more on the Gravity Forms forum.

Rounding by Increments GravityWiz

Gravity Perks has a snippet available to round numbers by increment using specific CSS classes. You can add the snippet to your functions.php file or download it as a plugin from their website. This can be also very handy if you want rounding on bigger numbers, like rounding to 100 if something is above 50.

FAQ about rounding numbers in Gravity Forms

Can you round numbers in Gravity Forms without a plugin?

There are no default options in Gravity Forms to round numbers. As explained on the Gravity Forms community forum, you’ll need some custom JavaScript/jQuery or if real-time rounding is not necessary, use Gravity Forms filters.

Can I use rounding for calculations with Advanced Number Field?

Yes, you can also apply rounding on calculations in Gravity Forms Number Fields. The rounding will take place on the final calculated value.

Up to how many decimal places can I round with Advanced Number Field?

You can round up Gravity Forms Number Fields up to 5 decimal places.

Can I force rounding to an integer with Advanced Number Field?

Yes, you can set the number of decimal places to 0 and the Gravity Forms Number Field will only accept whole numbers.

Our Premium Add-ons for Gravity Forms

List DatepickerAdd a Datepicker with calendar select to a column or multiple columns in a Gravity Forms List Field.
Update Multiple EntriesTrigger the update of multiple entries in a target form by submitting an entry in a trigger form.
List DropdownAdd a Dropdown Select with choices to a column or multiple columns in a Gravity Forms List Field.
JWT PrefillCreate JSON Webtokens to populate fields in your Gravity Form. With a secure key you can validate the data you don’t want to be tampered with.
List Number FormatWith this Gravity Forms Add-on you can change List Field columns into a number field, do calculations within a row or column. Extra merge tags are available with total counts of columns.
Advanced Merge TagsThis Gravity Forms Add-On adds extra Merge Tag modifiers (and a lot of power). From the most common used functions like capitalize and length to changing date formats.

Read more tutorials about GravityWP BV

GravityWP develops add-ons to collect and manage your data better.

Show all calculations Gravity FormsDo you need an overview of all the calculations in your Gravity Form? With our Merge Tags Add-on you can easily get a list of all calculations (formulas) in one form.
Pay per word with starting price for Gravity FormsWith the gwp_word_count merge tag modifier for Gravity Forms it is possible to use the word count value of a text field in a formula. This way you can create a flexible Pay per Word calculation based on the amount of words in a text field.
Substring Modifier for Gravity Forms Merge TagsDo you want to return a portion of a Merge Tag string output? And specify an offset and length of the part of the Merge Tag output? With Advanced Merge Tags it's as easy as it gets.
Quick overview of Gravity Forms Conditional Logic rulesWhen you're working with a lot of Conditional Logic rules in your form it can be a challenge to keep an overview. Our Merge Tags Add-on for Gravity Forms has a Conditional Logic Tab which creates a quick overview of all the rules in your form.
Bulk Update Gravity FormsEntriesDo you want to bulk update a large batch of Gravity Forms Entries? Like 12321 entries? A nearly undoable task by hand, but a breeze with our Update Multiple Entries add-on.

All tutorials GravityWP BV

Rounding numbers in Gravity Forms (2024)
Top Articles
Latest Posts
Article information

Author: Eusebia Nader

Last Updated:

Views: 5570

Rating: 5 / 5 (60 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Eusebia Nader

Birthday: 1994-11-11

Address: Apt. 721 977 Ebert Meadows, Jereville, GA 73618-6603

Phone: +2316203969400

Job: International Farming Consultant

Hobby: Reading, Photography, Shooting, Singing, Magic, Kayaking, Mushroom hunting

Introduction: My name is Eusebia Nader, I am a encouraging, brainy, lively, nice, famous, healthy, clever person who loves writing and wants to share my knowledge and understanding with you.