--- title: "Basic calculations for adding, subtracting, multiplying, and dividing" slug: "basic-calculations-adding-subtracting-multiplying-dividing" updated: 2026-09-28T06:23:24Z published: 2026-09-28T06:23:24Z canonical: "help.quickbase.com/basic-calculations-adding-subtracting-multiplying-dividing" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.quickbase.com/llms.txt > Use this file to discover all available pages before exploring further. # Basic calculations for adding, subtracting, multiplying, and dividing ## Overview The **Calculation** field allows you to **add**, **subtract**, **multiply,** and **divide** numeric fields in your forms. This can be useful for calculating price, quantity, or basic scores within your forms. To get started: 1. Add **Numeric** fields to your form in the Form Builder. 2. Add a **Calculation** field. 3. Select **Add Calculation** in the settings menu on the right. 4. Select the fields you wish to calculate and enter your desired formula in the **Calculation** **Formula** box. The following sections describe how to enter each type of calculation formula: ## Add (+) 1. Follow the steps in the Overview section. 2. Enter a **+** sign between the field keys of the two fields you wish to add. > [!NOTE] > **Note** > > *Make sure the field keys are surrounded by* ***$*** *signs.* 3. Press **Okay**. ![Calculation Formula box showing the Apple and Bread field keys joined with a plus sign](https://cdn.document360.io/dd260e4e-10bb-4b66-8fb3-5504c272b904/Images/Documentation/2017-11-15_1024.png?sv=2026-02-06&spr=https&st=2026-10-31T06%3A26%3A45Z&se=2026-10-31T07%3A26%3A45Z&sr=c&sp=r&sig=d90tDGI7yb6HE5G70PNpSjsBZUVPsu2mtnJxMeiw7%2Fw%3D) ```plaintext Price of Apple - $Apple_1$ added to Price of Bread - $Bread_1$ ``` In the **Calculation** field (labeled *Total*) we have added the two fields together using the **+** sign with each fieldkey surrounded by the **$** sign. ```plaintext $Apple_1$ + $Bread_1$ ``` ![Calculation field settings showing the addition formula with field keys](https://cdn.document360.io/dd260e4e-10bb-4b66-8fb3-5504c272b904/Images/Documentation/2017-11-15_1025.png?sv=2026-02-06&spr=https&st=2026-10-31T06%3A26%3A45Z&se=2026-10-31T07%3A26%3A45Z&sr=c&sp=r&sig=d90tDGI7yb6HE5G70PNpSjsBZUVPsu2mtnJxMeiw7%2Fw%3D) > [!NOTE] > **Note** > > Since we are calculating a price, we also need to allow for 2 decimal places for each of the Numeric fields (**Numeric Settings** > **Decimals**) and the Calculation field (**Calculation Settings** > **Decimals**). ![Decimal places setting in the Numeric and Calculation field configuration](https://cdn.document360.io/dd260e4e-10bb-4b66-8fb3-5504c272b904/Images/Documentation/add_2.png?sv=2026-02-06&spr=https&st=2026-10-31T06%3A26%3A45Z&se=2026-10-31T07%3A26%3A45Z&sr=c&sp=r&sig=d90tDGI7yb6HE5G70PNpSjsBZUVPsu2mtnJxMeiw7%2Fw%3D) After saving and publishing the form, we can now go into the FastField App and fill out those two fields. Our *Total* field will add those two fields together and show the total price. ![FastField app showing the Total field displaying the added price](https://cdn.document360.io/dd260e4e-10bb-4b66-8fb3-5504c272b904/Images/Documentation/add_6.png?sv=2026-02-06&spr=https&st=2026-10-31T06%3A26%3A45Z&se=2026-10-31T07%3A26%3A45Z&sr=c&sp=r&sig=d90tDGI7yb6HE5G70PNpSjsBZUVPsu2mtnJxMeiw7%2Fw%3D) ## Subtract (-) 1. Follow the steps in the Overview section. 2. Enter a **-** sign between the field keys of the two fields you wish to subtract. > [!NOTE] > **Note** > > Make sure the field keys are surrounded by $ signs. 3. Press **Okay**. **Example:** - In the example below, we have two numeric fields (*Price of Bread* and *Price of Apple*) that we wish to subtract. ![Calculation Formula box showing the Bread and Apple field keys joined with a minus sign](https://cdn.document360.io/dd260e4e-10bb-4b66-8fb3-5504c272b904/Images/Documentation/2017-11-15_1024.png?sv=2026-02-06&spr=https&st=2026-10-31T06%3A26%3A45Z&se=2026-10-31T07%3A26%3A45Z&sr=c&sp=r&sig=d90tDGI7yb6HE5G70PNpSjsBZUVPsu2mtnJxMeiw7%2Fw%3D) ```plaintext Price of Bread - $Bread_1$ subtracted from Price of Apple - $Apple_1$ ``` In the **Calculation** field (labeled *Total*) we have subtracted the price of bread from the price of an apple using the **-** sign. Each fieldkey is surrounded by the **$** sign. ```plaintext $Apple_1$ - $Bread_1$ ``` ![Calculation field settings showing the subtraction formula with field keys](https://cdn.document360.io/dd260e4e-10bb-4b66-8fb3-5504c272b904/Images/Documentation/2017-11-15_1027.png?sv=2026-02-06&spr=https&st=2026-10-31T06%3A26%3A45Z&se=2026-10-31T07%3A26%3A45Z&sr=c&sp=r&sig=d90tDGI7yb6HE5G70PNpSjsBZUVPsu2mtnJxMeiw7%2Fw%3D) > [!NOTE] > **Note** > > Because I am calculating a price, I will need to make sure to allow for 2 decimal places in the builder for each of my numeric fields and also for my calculation field. See the picture below. ![Decimal places setting in the Numeric and Calculation field configuration](https://cdn.document360.io/dd260e4e-10bb-4b66-8fb3-5504c272b904/Images/Documentation/add_2.png?sv=2026-02-06&spr=https&st=2026-10-31T06%3A26%3A45Z&se=2026-10-31T07%3A26%3A45Z&sr=c&sp=r&sig=d90tDGI7yb6HE5G70PNpSjsBZUVPsu2mtnJxMeiw7%2Fw%3D) After saving and publishing the form, I will now go into the app and fill out those two fields. My **Total** field will subtract those fields from each other ![FastField app showing the Total field displaying the subtracted price](https://cdn.document360.io/dd260e4e-10bb-4b66-8fb3-5504c272b904/Images/Documentation/subtract_2.png?sv=2026-02-06&spr=https&st=2026-10-31T06%3A26%3A45Z&se=2026-10-31T07%3A26%3A45Z&sr=c&sp=r&sig=d90tDGI7yb6HE5G70PNpSjsBZUVPsu2mtnJxMeiw7%2Fw%3D) ## Multiply (*) 1. Follow the steps in the Overview section. 2. Enter a ***** sign between the field keys of the two fields you wish to multiply together. > [!NOTE] > **Note** > > Make sure the field keys are surrounded by $ signs. 3. Press **Okay**. **Example:** - In the example below, we want to multiply the **price** of each product by the **quantity**. - We created a **Numeric** field for each product (*Price of Bread*, *Price of Apple*). - After each product, we have a **Numeric** field for the quantity (*Quantity*). - At the end, we have **Calculation** fields for the total price of each product (*Total Price of Bread*, *Total Price of Apples*). > [!NOTE] > **Note** > > *We have two Calculation fields to show the total price of each item separately. You could also have just one Calculation field that shows the total of all items together.* ![Form Builder showing Numeric fields for price and quantity alongside Calculation fields for total price](https://cdn.document360.io/dd260e4e-10bb-4b66-8fb3-5504c272b904/Images/Documentation/2017-11-15_1029.png?sv=2026-02-06&spr=https&st=2026-10-31T06%3A26%3A45Z&se=2026-10-31T07%3A26%3A45Z&sr=c&sp=r&sig=d90tDGI7yb6HE5G70PNpSjsBZUVPsu2mtnJxMeiw7%2Fw%3D) For review, these are the fields and their associated fieldkeys. ### Example: Apples --- ```plaintext Price of Apple - $Apple_1$ multiplied by Quantity - $Qty_Apple$ ``` The calculation inside of your **Total Price of Apples** will look like this ```plaintext $Apple_1$ * $Qty_Apple$ ``` ![Calculation field settings showing the multiplication formula for the apple price and quantity](https://cdn.document360.io/dd260e4e-10bb-4b66-8fb3-5504c272b904/Images/Documentation/2017-11-15_1033.png?sv=2026-02-06&spr=https&st=2026-10-31T06%3A26%3A45Z&se=2026-10-31T07%3A26%3A45Z&sr=c&sp=r&sig=d90tDGI7yb6HE5G70PNpSjsBZUVPsu2mtnJxMeiw7%2Fw%3D) This is what it looks like in the app after filling it out ![FastField app showing the Total Price of Apples field after multiplication](https://cdn.document360.io/dd260e4e-10bb-4b66-8fb3-5504c272b904/Images/Documentation/multiply_apple.png?sv=2026-02-06&spr=https&st=2026-10-31T06%3A26%3A45Z&se=2026-10-31T07%3A26%3A45Z&sr=c&sp=r&sig=d90tDGI7yb6HE5G70PNpSjsBZUVPsu2mtnJxMeiw7%2Fw%3D) ### Example: Bread --- It will be the same thing for the bread; as follows ```plaintext Price of Bread - $Bread_1$ multiplied by Quantity - $Qty_Bread$ ``` The calculation inside of your **Total Price of Bread** will look like this ```ruby $Bread_1$ * $Qty_Bread$ ``` ![Calculation field settings showing the multiplication formula for the bread price and quantity](https://cdn.document360.io/dd260e4e-10bb-4b66-8fb3-5504c272b904/Images/Documentation/2017-11-15_1035.png?sv=2026-02-06&spr=https&st=2026-10-31T06%3A26%3A45Z&se=2026-10-31T07%3A26%3A45Z&sr=c&sp=r&sig=d90tDGI7yb6HE5G70PNpSjsBZUVPsu2mtnJxMeiw7%2Fw%3D) This is what it looks like in the app after filling it out ![FastField app showing the Total Price of Bread field after multiplication](https://cdn.document360.io/dd260e4e-10bb-4b66-8fb3-5504c272b904/Images/Documentation/multiply_bread.png?sv=2026-02-06&spr=https&st=2026-10-31T06%3A26%3A45Z&se=2026-10-31T07%3A26%3A45Z&sr=c&sp=r&sig=d90tDGI7yb6HE5G70PNpSjsBZUVPsu2mtnJxMeiw7%2Fw%3D) ## Divide (/) 1. In your form, add multiple **Numeric** fields. 2. Add a **Calculation** field that will add the Numeric fields to show their *total* value (see *Add* above). 3. Add another **Calculation** field that will show the *average* value and select **Add Calculation.** 4. In the Calculation Formula box, enter the field key for the Calculation field that will show the *average.* > [!NOTE] > **Note** > > Make sure the field key is surrounded by $ signs. 5. After the field key put a forward slash (**/**) and the number of Numeric fields that will be divided - **Example:** $Average$ / 3 6. Press **Okay**. **Example:** - In the example below, we will use multiplication, addition, and division to get an average price. - For our Numeric fields, we have **Price of Bread 1** and **Price of Bread 2***,* each with their own **Quantity** fields below. - First, we want to multiply **Total Price of Bread 1** by its **Quantity** to get the **Total Price of Bread 1** *(see Multiply above)*. - Then, we will do the same for **Total Price of Bread 2**. - Next, we will add those two totals together to get the **Total Price** *(see Add above).* - To get the average price, we will create a Calculation field that divides the **Total Price** and by 2, which is the number of **Total Price of Bread** fields that we have. - This will give us the **Average Price of Bread**. - Below is a screenshot of all of the fields and their names: ![Form Builder showing the Numeric and Calculation fields used to calculate an average price](https://cdn.document360.io/dd260e4e-10bb-4b66-8fb3-5504c272b904/Images/Documentation/2017-11-15_1038.png?sv=2026-02-06&spr=https&st=2026-10-31T06%3A26%3A45Z&se=2026-10-31T07%3A26%3A45Z&sr=c&sp=r&sig=d90tDGI7yb6HE5G70PNpSjsBZUVPsu2mtnJxMeiw7%2Fw%3D) Below are the calculation field names, their fieldkeys in (parenthesis) and their contained calculations follow the = equal sign. ```plaintext Total Price of Bread 1 (total_bread_1) = $price_bread_1$ * $qty_bread_1$ Total Price of Bread 2 (total_bread_2) = $price_bread_2$ * $qty_bread_2$ Total Price (total_price) = $total_bread_1$ + $total_bread_2$ Average Price of Bread (avg_price_bread) = $total_price$ / 2 ``` Now that the calculations have been added, I can now save and publish my form and make sure everything is calculating correctly. As you can see from the following screenshot, everything looks correct. ![FastField app showing the calculated average price after division](https://cdn.document360.io/dd260e4e-10bb-4b66-8fb3-5504c272b904/Images/Documentation/divide_03.png?sv=2026-02-06&spr=https&st=2026-10-31T06%3A26%3A45Z&se=2026-10-31T07%3A26%3A45Z&sr=c&sp=r&sig=d90tDGI7yb6HE5G70PNpSjsBZUVPsu2mtnJxMeiw7%2Fw%3D) ## Calculation field returning a monetary value (E.g., if a user enters *1234567*, it will appear as *$1,234,567.00*) In a normal situation, if you are calculating the values of two fields, the calculation field will return you a value void of commas or the monetary identifier of your choice, ($, £, €, etc.). This is because the calculation field is built to return a value that is ready to be calculated, void of any strings or confusion. If you would like to add this type of eye candy to your end calculation, however, you can follow these steps: 1. Highlight everything between the lines, and place it in your calculation field. 2. Place the fieldkey you are referencing in the "$field_key$" area of the calculation. 3. If you want to change the monetary indicator from dollars (**$**) to something else of your choice, then find r = "$" + n.toFixed(2); in the following formula, and replace the **$** with the symbol of your choice. Formula ```plaintext function formatCurrency(nStr) {    nStr += '';    var x = nStr.split('.');    var x1 = x[0];    var x2 = x.length > 1 ? '.' + x[1] : '';    var rgx = /(\d+)(\d{3})/;    while (rgx.test(x1)) {        x1 = x1.replace(rgx, '$1' + ',' + '$2');    }    return x1 + x2; } n = float($field_key$); r = "$" + n.toFixed(2); return formatCurrency(r); ``` How You Do It ![Calculation Formula box with the currency formatting JavaScript function entered](https://cdn.document360.io/dd260e4e-10bb-4b66-8fb3-5504c272b904/Images/Documentation/Screen_Shot_2021-10-15_at_3.31.53_PM.png?sv=2026-02-06&spr=https&st=2026-10-31T06%3A26%3A45Z&se=2026-10-31T07%3A26%3A45Z&sr=c&sp=r&sig=d90tDGI7yb6HE5G70PNpSjsBZUVPsu2mtnJxMeiw7%2Fw%3D) The Result ![FastField app showing the calculation field formatted as a currency value](https://cdn.document360.io/dd260e4e-10bb-4b66-8fb3-5504c272b904/Images/Documentation/Screen_Shot_2021-10-15_at_3.31.33_PM.png?sv=2026-02-06&spr=https&st=2026-10-31T06%3A26%3A45Z&se=2026-10-31T07%3A26%3A45Z&sr=c&sp=r&sig=d90tDGI7yb6HE5G70PNpSjsBZUVPsu2mtnJxMeiw7%2Fw%3D)