Perform Calculations | Formula Field - Zoho Forms

Using the Formula Field

Overview

Make your form a math wiz by allowing it to perform calculations. You can total up costs, compare dates, apply discounts, use built-in functions and more! 
Use the Formula field to set up any form calculation. When your respondents fill in the form, calculations will be performed based on their input. The answer will be displayed in the field you have entered your formula in.
Formula Field
Using the Formula field you can,
  • Perform mathematical operations such as addition, subtraction, multiplication, and division
  • Use certain math functions to calculate differences between two times, dates, and more 
  • Set up conditional calculations to perform calculations based on the respondent's answers  

Setup

To add a formula field to your form,

  1. Drag and drop or click the Formula field under the Advanced Fields section.
  2. In the pop-up, your form fields would appear in the left pane. Use the fields on the left, numbers, and mathematical operators on the right to come up with your formula.

    Formula field setup
  3. Click Done.
  4. You can choose to hide this field from your respondents using the Hide Field option under Properties
  5. If you wish to edit your formula, click the Edit link under Properties.
For example, you can calculate the amount your customer has to pay using the formula field and display the amount in the payment field automatically. For this, you can set the formula as  Item * Quantity, where the numeric value assigned for the field Item will be taken for the calculation.

Supported Field Types for Formula
Number, Decimal, Currency, Slider, Rating, Formula, Radio, Checkbox, Multiple Choice, Dropdown, Image Choice, Date, Date-Time, Time
Note
While using the Formula field as a variable for calculating another formula, ensure that the two formulas are not mutually dependent. If you have come across an error because two formulas are mutually dependent, then refer to the below example:
If  n1, n2, n3 are three number fields, and f1, f2, f3 are the formulas that you have created where,

f1= n1+ n2 
f2= n3 + f3
f3= f1 + f2

Formula 2 depends on Formula 3's answer (and vice versa) to perform calculations, resulting in an endless loop. Recheck your formula to avoid this type of infinite loop.

Functions

Using the math functions we support, you can calculate the differences between time and date fields, and also round off decimal numbers into integers. You will find Functions in the right pane of the Formula field pop-up. 

To use a function,
  1. Tap on the math function you wish to add.
  2. It generates a syntax like this: Function (Field Name - Field Name).
  3. Replace the field's placeholders with the required form fields by clicking them from the left pane. 

    Using functions in Formula field
Supported Math Functions

Function
Role
Supported Field Types
DayDiff
Returns the day difference between two date values
Date, Date-Time
MonthDiff
Returns the month difference between two date values
Date, Date-Time
YearDiff
Returns the year difference between two date values
Date, Date-Time
HourDiff
Returns the hour difference between two time values
Time, Date-Time
MinutesDiff
Returns the minute difference between two time values
Time, Date-Time
RoundUp
Rounds off the decimal number to that next value, away from zero
Decimal, Currency, Formula
RoundDown
Rounds off the decimal number to that of the previous value
Decimal, Currency, Formula
Round
Rounds off a decimal number to that of the next number when the decimal
value is .5 or above, and to the previous number when the decimal value is below .5
Decimal, Currency, Formula
Age
Returns the age in years from the selected date as of the current date. If the selected Date field is left blank, or if the selected date is a future date relative to the current date, the age will be taken as 0.
When calculating age, the months completed are not returned. For example, if the age calculated is 19 years and 7 months, only 19 years is returned.
Date, Date-Time
SelectionCount
Returns the number of options selected in the supported choice based field types. If a choice field (supported field) in Subform is used within the formula, this function returns the sum of all choices selected
Multiple Choice, Checkbox,  Image Choices
CurrentDate
This field is used to return the difference between the current date and the selected date in the  DayDiff,  MonthDiff, and  YearDiff functions
Date, Date-Time

Adding a Unit to Formula

You can add a unit to your formula to show the result more contextually in the live form. A unit can be added once the formula configuration is completed. 
To include a unit for the formula calculated value, enter a suitable Unit under Properties.

Add Unit to Formula

You can select to position this unit either as a Prefix or a Suffix

Prefix or suffix the unit
Note: If you choose to include unit to the formula calculated value in a Subform, note that the unit will be displayed only in the Subform's Pop-up mode.

    Zoho CRM Training Programs

    Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

    Zoho CRM Training
      Redefine the way you work
      with Zoho Workplace

        Zoho DataPrep Personalized Demo

        If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

        Zoho CRM Training

          Create, share, and deliver

          beautiful slides from anywhere.

          Get Started Now


            Zoho Sign now offers specialized one-on-one training for both administrators and developers.

            BOOK A SESSION





                        Still can't find what you're looking for?

                        Write to us:  support@zohoforms.com


                              




                            

                            Zoho Marketing Automation

                              Zoho Sheet Resources

                               




                                  Zoho Forms Resources


                                    Secure your business
                                    communication with Zoho Mail


                                    Mail on the move with
                                    Zoho Mail mobile application

                                      Stay on top of your schedule
                                      at all times


                                      Carry your calendar with you
                                      Anytime, anywhere




                                            Zoho Sign Resources

                                              Sign, Paperless!

                                              Sign and send business documents on the go!

                                              Get Started Now


                                                  Zoho SalesIQ Resources



                                                      Zoho TeamInbox Resources



                                                              Zoho DataPrep Resources



                                                                Zoho DataPrep Demo

                                                                Get a personalized demo or POC

                                                                REGISTER NOW


                                                                  Design. Discuss. Deliver.

                                                                  Create visually engaging stories with Zoho Show.

                                                                  Get Started Now











                                                                                          • Related Articles

                                                                                          • Using Conditional Formula

                                                                                            The conditional formula set up in Zoho Forms allows you to configure your form to perform certain calculations based on your respondents' answers. These predefined conditions are simple to set up and they will tailor your form to your user's needs. ...
                                                                                          • How do I use formula field and auto-populate the calculated value in Payments field?

                                                                                            Money is a tricky thing. It has the potential to alter the course of any alliance, particularly one involving payments. Seller- buyer relationships can quickly become a hassle if the money flow is not error-free. And like always, Zoho Forms is here ...
                                                                                          • Field Properties

                                                                                            Table of Contents Overview Dynamic Field Labels Rename Uploaded Files Assign Values to Choices Group Choices Overview You can set the properties to customize each field added to your form. To do so, click the field on your form builder. Under ...
                                                                                          • Field Rules

                                                                                            Overview Using the Field Rules, you can choose to show or hide certain form fields to your respondents or set certain fields as mandatory to fill in based on their input. This way, you can let your respondents see only the fields that are relevant to ...
                                                                                          • Date Field

                                                                                            With the Date field in Zoho Forms, you can customize calendars to set the range of dates that you want to allow your respondents to choose from. You can set the starting day of all the weeks across the calendar, allow respondents to pick dates that ...
                                                                                          Wherever you are is as good as
                                                                                          your workplace

                                                                                            Resources

                                                                                            Videos

                                                                                            Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                            eBooks

                                                                                            Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                            Webinars

                                                                                            Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                            CRM Tips

                                                                                            Make the most of Zoho CRM with these useful tips.



                                                                                              Zoho Show Resources