# Basics of Using Formulas

Article Number:040509

By setting a formula in an app, you can calculate the sum of multiple values or have a value automatically displayed according to conditions specified in a function.

## Formula basics

It is necessary to understand the following three points when using formulas.

### Formulas are entered on the settings screens of "Calculated" and "Text" fields

Formulas can be used only with "Calculated" and "Text" fields.
Use a "Calculated" field if you want the calculation result to be treated as a numeric value, or use a "Text" field if you want the result to be treated as a string value.

### Field codes are used to refer to fields in a formula

A field code is a string used for identifying a field. In formulas, field codes are used to refer to other fields.
For details, refer to the following pages.
Overview of Field Codes
Fields That Can/Cannot Be Referenced in Formulas

Clicking Insert Field Code displays a list of the field codes that exist in the app you are using.
Select a field code from the list to have it entered in the Formula input field.

### Formulas use functions and operators

Formulas in Kintone support half-width operators (e.g., "+", "-", "*", "/"), as well as functions.
You can use multiple operators and functions together in a single formula.
List of Operators and Functions

Clicking Insert Function displays a list of the functions you can use in Kintone.
Select a function from the list to have it entered in the Formula input field.

## How to set formulas

As an example of how to set a formula, this section walks you through setting up a formula that multiplies a unit price and quantity to produce a subtotal.
You will use "Number" fields for entering numeric values, and a "Calculated" field for displaying the calculation result.

1. Click the App Settings icon (the gear-shaped icon at the upper right of the app's "View" screen), then select the Form tab.

2. Place two "Number" fields on the app form by dragging the "Number" field displayed in the list of fields on the left side of the screen and then dropping it onto the area on the right side of the screen.

3. Open the settings screen of the "Number" field that will be used for entering a unit price. To do so, click the Settings icon (the gear-shaped icon) at the upper right of the "Number" field, then click Settings.

4. Enter "Unit price" in the Name input field.

5. Enter "Unit_price" in the Field Code input field.

6. Click Save.

7. Open the settings screen of the "Number" field that will be used for entering a quantity. To do so, click the Settings icon (the gear-shaped icon) at the upper right of the "Number" field, then click Settings.

8. Enter "Quantity" in the Name input field.

9. Enter "Quantity" in the Field Code input field.

10. Click Save.

11. Place a "Calculated" field on the app form.

12. Open the settings screen of the "Calculated" field. From the Settings icon (the gear-shaped icon) at the upper right of the "Calculated" field, click Settings.

13. Enter "Subtotal" in the Name input field.

14. Enter the following formula in the Formula input field.

The content has been copied.
``Unit_price*Quantity``

15. Click Save.

16. Click Save Form on the upper left side of the screen.

17. If you are creating a new app, click Activate App at the upper right of the screen and click OK on the confirmation dialog.
If you are changing the settings of an existing app, click Update App at the upper right of the screen and click Update App on the confirmation dialog.

Now you have completed setting the formula.
When you enter a unit price and quantity on the "New Record" or "Edit Record" screen, the calculation result will appear in the "Subtotal" field.

## If an error message appears

If an error message appears when setting a formula or entering data on a record, refer to the following pages for solutions.