Skip to content
GravityKit
Buy
Sign in
0 items
  • Plugins

    GravityKit All Access

    Our complete Kit of essential tools for extending and enhancing Gravity Formsโ€”everything you need to build powerful web apps and workflows.

    Learn more
    • GravityView

      GravityView

      Bestseller

      Display Gravity Forms entries on the front-end of your site and build powerful web applications.

    • GravityImport

      GravityImport

      Trending

      Import entries from CSV files into Gravity Forms to transfer data, create new forms, or update existing entries.

    • GravityEdit

      GravityEdit

      Quickly edit Gravity Forms entries inline to save time, reduce clicks, and streamline your workflow.

    • GravityCharts

      GravityCharts

      Trending

      Turn Gravity Forms entries into interactive charts and graphs.

    • GravityActions

      GravityActions

      Update multiple Gravity Forms entries at once, send bulk emails, and streamline your workflow.

    • GravityCalendar

      GravityCalendar

      Turn Gravity Forms entries into dynamic calendars to showcase events, schedules, appointments, and more.

    • GravityExport

      GravityExport

      Export Gravity Forms entries to Excel, CSV, or PDF and share them instantly with secure download links.

    • GravityMath

      GravityMath

      Perform advanced calculations on Gravity Forms entries to display totals, averages, or build custom calculators.

    • GravityRevisions

      GravityRevisions

      Track, compare, and restore changes made to Gravity Forms forms and entries with a full version history.

    • GravityMigrate

      GravityMigrate

      Migrate all Gravity Forms data, including forms, entries, Views, feeds, uploads, and more.

    • GravityBoard

      GravityBoard

      Manage projects with collaborative project management. Coordinate with your team and streamline your workflows.

  • Ideal For

    • Nonprofits
    • Startups
    • Education
    • Web Agencies
    • Developers
    • Government iconGovernment
    Explore All Use Cases

    Case studies

    • West Fork Schools
    • Princeton University
    • BrightLeaf Giving
    • Jacksonville Port Authority
    • National Severe Storms Lab
    • Leadpal
    • Mediebruket
    • Dragonfly
    View All Case Studies
  • Resources

    • Blog
    • Case studies
    • Support
    • Live Demos
    • Documentation
    • Developer docs
    • GravityKit Academy
    • GravityKit Live!

    Ultimate guides

    • How to use Gravity Forms
    • Editing Gravity Forms entries
    • Importing Gravity Forms entries
    • Exporting Gravity Forms entries
    • Displaying Gravity Forms entries
    • Gravity Forms conditional logic
    • Gravity Forms calculations
    View More Articles
  • Plugins

    • GravityView

      GravityView

      Bestseller

      Display Gravity Forms entries on the front-end of your site and build powerful web applications.

    • GravityImport

      GravityImport

      Trending

      Import entries from CSV files into Gravity Forms to transfer data, create new forms, or update existing entries.

    • GravityEdit

      GravityEdit

      Quickly edit Gravity Forms entries inline to save time, reduce clicks, and streamline your workflow.

    • GravityCharts

      GravityCharts

      Trending

      Turn Gravity Forms entries into interactive charts and graphs.

    • GravityActions

      GravityActions

      Update multiple Gravity Forms entries at once, send bulk emails, and streamline your workflow.

    • GravityCalendar

      GravityCalendar

      Turn Gravity Forms entries into dynamic calendars to showcase events, schedules, appointments, and more.

    • GravityExport

      GravityExport

      Export Gravity Forms entries to Excel, CSV, or PDF and share them instantly with secure download links.

    • GravityMath

      GravityMath

      Perform advanced calculations on Gravity Forms entries to display totals, averages, or build custom calculators.

    • GravityRevisions

      GravityRevisions

      Track, compare, and restore changes made to Gravity Forms forms and entries with a full version history.

    • GravityMigrate

      GravityMigrate

      Migrate all Gravity Forms data, including forms, entries, Views, feeds, uploads, and more.

    • GravityBoard

      GravityBoard

      Manage projects with collaborative project management. Coordinate with your team and streamline your workflows.

    GravityKit All Access

    Our complete Kit of essential tools for extending and enhancing Gravity Formsโ€”everything you need to build powerful web apps and workflows.

    Learn more
  • Ideal For

    • Nonprofits
    • Startups
    • Education
    • Web Agencies
    • Developers
    • Government iconGovernment
    Explore All Use Cases

    Case studies

    • West Fork Schools
    • Princeton University
    • BrightLeaf Giving
    • Jacksonville Port Authority
    • National Severe Storms Lab
    • Leadpal
    • Mediebruket
    • Dragonfly
    View All Case Studies

    How to build...

    • Property Management
    • Product Catalog
    • Fundraising Dashboard
    • Real Estate Directory
    • Document Library
    • Academic Journal
    • Volunteer Management
    • Meal Tracker
    View All Guides
  • Resources

    • Blog
    • Case studies
    • Support
    • Live Demos
    • Documentation
    • Developer docs
    • GravityKit Academy
    • GravityKit Live!

    ultimate guides

    • How to use Gravity Forms
    • Editing Gravity Forms entries
    • Importing Gravity Forms entries
    • Exporting Gravity Forms entries
    • Displaying Gravity Forms entries
    • Gravity Forms conditional logic
    • Gravity Forms calculations
    View More Articles
  • Pricing
  • About
0 items
Results appear automatically as you type.
Loading results…

results found matching

    Sign in
    Buy

    Docs

    • Docs Home

    Gravity Forms Add-Ons

    • GravityView
    • GravityActions
    • GravityBoard
    • GravityCalendar
    • GravityCharts
    • GravityEdit
    • GravityExport
    • GravityImport
    • GravityMath
    • GravityMigrate
    • GravityRevisions
    • GF Widget for Elementor
    • GF Dynamic Lookup
    • GF Entry Tags
    • GF Event Field
    • GF Zero Spam
    • GravityExport Lite

    GravityView

    • Getting Started
    • View Setup
    • FAQ
    • Pre-Sale
    • Advanced
    • Common Problems
    • Customizing Your Views
    • Edit Entry
    • Entry Approval
    • Filter and Sort Results
    • Gravity Forms
    • Merge Tags
    • Roles and Capabilities
    • Search
    • Shortcodes
    • View Settings
    • WordPress Posts

    General Help

    • Account, Invoices, and Billing
    • License Related
    • Plugins and Settings
    • Contact
    • Docs Home
    • Gravity Forms Add-Ons

      • GravityView
      • GravityActions
      • GravityBoard
      • GravityCalendar
      • GravityCharts
      • GravityEdit
      • GravityExport
      • GravityImport
      • GravityMath
      • GravityMigrate
      • GravityRevisions
      • GF Widget for Elementor
      • GF Dynamic Lookup
      • GF Entry Tags
      • GF Event Field
      • GF Zero Spam
      • GravityExport Lite
    • GravityView

      • Getting Started
      • View Setup
      • FAQ
      • Pre-Sale
      • Advanced
      • Common Problems
      • Customizing Your Views
      • Edit Entry
      • Entry Approval
      • Filter and Sort Results
      • Gravity Forms
      • Merge Tags
      • Roles and Capabilities
      • Search
      • Shortcodes
      • View Settings
      • WordPress Posts
    • General Help

      • Account, Invoices, and Billing
      • License Related
      • Plugins and Settings
    • Contact

    GravityMath

    • Add calculations to blog posts
    • Calculating Survey fields totals based on their scoring
    • Calculations in GravityView
    • Can GravityMath be used inside a Gravity Forms form?
    • Can I use [gravitymath] with [gvlogic]?
    • Can I use [gravitymath] with dates and times?
    • Can I use [gravitymath] with Multiple Forms?
    • Debugging Calculations in GravityMโ€‹ath
    • Developer Hooks for GravityMath
    • Does GravityMath support the Polls Add-on?
    • Does GravityMath support the Survey Add-on?
    • GravityMath Calculation field
    • How to add field calculations to the table footer
    • How to Calculate the Sum of a Field in Gravity Forms
    • How to display summaries using a block, widget, or shortcode
    • How to enable duration calculations in Gravity Forms with GravityMath
    • How to perform Gravity Forms time calculations in GravityView using GravityMath
    • Math filters: How to target a specific field value with [gravitymath] filters
    • Nested calculations in GravityMath
    • Pricing fields calculation
    • Sum GravityMath values for today, a custom date range, or a rolling window
    • The [gravitymath] Shortcode
    • The {entry_count} Merge Tag in Math by GravityView
    • Using GravityMath inside a GravityView Custom Content field
    • When to use GravityMath and when to use GP Advanced Calculations
    • Home
    • Docs
    • GravityMath
    • How to Calculate the Sum of a Field in Gravity Forms

    How to Calculate the Sum of a Field in Gravity Forms

    Estimated reading: 1 minutes

    Updated on April 23, 2026

    Using the [gravitymath] shortcode you can calculate the sum of a field for all entries in a form.ย 

    Prefer to Watch the Video?

    We need two things to find the sum of a field for all form entries:

    1. The Form ID
    2. The Merge Tag of the field we want to sum

    The shortcode will look like this:

    [gravitymath scope="form" id="4"] {merg tag:2} [/gravitymath]
    		

    scope="form"ย tells the shortcode that weโ€™re working with data from a form (as opposed to a View). The id value refers to the ID of your form in Gravity Forms and the merge tag should be the merge tag of the field you want to sum. Merge tags are always wrapped in curly brackets.

    Note: The default behavior for [gravitymath] is to output a sum. If you want to output a count instead, you can use the :count operator, like this: {merge_tag:2:count}.

    Finding Your Form ID:ย  #

    Hover over Forms in your WordPress admin menuย and click on Forms, youโ€™ll see the form ID in the first column on the right.

    Dashboard listing forms with IDs emphasized for calculation reference

    Finding the Fieldโ€™s Merge Tag #

    Here’s an easy way to find the merge tag for any field in your form.

    From the form editor, hover over Settings at the top and click on Notifications.

    Gravity Forms settings menu open, highlighting the Notifications option

    Now, click Add New to create a new notification (weโ€™re not going to save it, weโ€™re only using this as a way to get the merge tag!).

    Notifications settings page with an "Add New" button highlighted

    Scroll down to the text editor and click on the merge tag button on the right.ย 

    Gravity Forms interface showing Visual and Text tabs with an arrow pointing to code button

    Now, select the name of the field you want to sum from the list.

    Dropdown menu in Gravity Forms; user selects "Number of Attendees" field

    You’ll see the field merge tag appear in the text editor. Copy it to add to your shortcode.

    Editor displaying field placeholder "{Number of Attendees:4}" in Gravity Forms

    Displaying the Sum of a Field on Your Website #

    You can add the [gravitymath] shortcode anywhere on your website!ย 

    As you can see, here weโ€™ve added it to a new page.

    Guests attending shown with a Gravity Forms math shortcode for calculating number of attendees

    And on the front end, the shortcode is replaced with the sum of all values in the field.

    Text shows guest count for a Space Station event and links to an online store for flight suits

    Adding the Shortcode to a View #

    You can add the [gravitymath] shortcode to a View by pasting it inside a Custom Content field or widget.

    To do this, go to your View editor, click the Add Widget button and select Custom Content.

    Add Widget options in Gravity Forms: Search Bar, Custom Content, Gravity Forms, and Page Size

    Next, open the widget settings by clicking on the gear icon. Now, paste the shortcode inside the text editor along with any other text/HTML you want to display.

    Using Gravity Forms shortcode to calculate total guest count

    As you can see, the shortcode is replaced on the front end.

    Total number of guests attending is shown as six, with buttons for copy, CSV, and print

    To learn more about [gravitymath] and how to perform advanced calculations, read our ultimate guide to Gravity Forms calculations.

    Still stuck? How can we help?

    How can we help?

    "*" indicates required fields

    This field is for validation purposes and should be left unchanged.
    Replies will go to this email.
    How can we help?*
    My pre-sale question is related to...*
    My WordPress skills are....*
    My Gravity Forms skills are...*
    You will be shown articles from our documentation.
    Vous pouvez nous รฉcrire dans votre langue maternelle si cโ€™est plus facile pour vousโ€”nous nous occuperons de la traduction!
    Puedes escribirnos en tu idioma nativo si te resulta mรกs fรกcil; ยกnosotros nos encargamos de la traducciรณn!
    Sie kรถnnen uns in Ihrer Muttersprache schreiben, wenn das fรผr Sie einfacher ist โ€“ wir kรผmmern uns um die รœbersetzung!
    U kunt ons in uw moedertaal schrijven als dat gemakkelijker voor u is โ€” wij zorgen voor de vertaling!
    Du kan skrive til oss pรฅ ditt morsmรฅl hvis det er enklere for deg โ€” vi tar oss av oversettelsen!
    Du kan skriva till oss pรฅ ditt modersmรฅl om det รคr lรคttare fรถr dig โ€” vi tar hand om รถversรคttningen!
    Vocรช pode nos escrever em seu idioma nativo se for mais fรกcil para vocรช โ€” nรณs cuidaremos da traduรงรฃo!
    Puoi scriverci nella tua lingua madre se ti รจ piรน facile โ€” penseremo noi alla traduzione!
    Please provide as much detail as you're able; this helps us provide you with faster support.
    Drop files here or
    Accepted file types: jpg, jpeg, gif, png, tiff, pdf, bmp, zip, json, csv, xls, xlsx, Max. file size: 256 MB.
      Stay informed?

      Was this page helpful?

      Table Of Contents
      • Finding Your Form ID:ย 
      • Finding the Fieldโ€™s Merge Tag
      • Displaying the Sum of a Field on Your Website
      • Adding the Shortcode to a View
      GravityKit
      • How to Build It
      • Pricing
      • Products
      • Our Team
      • Our Values
      • Work With Us
      • Coupons
      Support
      • Support
      • Contact
      • Documentation
      • Scope of Support
      • Brand Guidelines
      • Privacy Policy
      • Terms of Service (โ€œTermsโ€)
      About Us
      • GravityKit on Mastodon
      • GravityKit on Twitter
      • GravityKit Training Courses
      • GravityKit on Facebook
      • Join our Facebook Group
      • Facebook
      • Twitter
      Get notified of updates.

      Weโ€™re constantly improving GravityKit. Fill out your email below and weโ€™ll notify you anytime major updates drop.

      GravityKit is a Gravity Forms Certified Developer.

      Copyright ยฉ 2026, Katz Web Services, Inc.

      GravityKit and GravityView are registered trademarks of Katz Web Services, Inc.