# Using Formulas for Math Calculations

Webix SpreadSheet supports simple math expressions and allows making calculations with the help of formulas. The following elements are allowed in formulas:

* numbers
* basic mathematical operators, which are: +, -, /, \*
* comparison operators: **<**, **>**, **<=**, **>=**, **<>**, **=**
* the **&** operator for connecting two or more text strings into a single text
* cell references
* Excel-like functions

## Adding a Formula

There are two ways you can add a formula.

To add formula manually:

1. Type the **=** sign in a cell to start the formula.
2. Type a combination of numbers and math operators:

* **+** - for adding
* **-** - for subtracting
* **\*** - for multiplying
* **/** - for dividing

For example: =8+5, =8-5, =8\*5, =8/5.

You can also enter any Excel function after the "=" symbol, f.e. =SUM(C2:D2).

To add a formula from the list:

1. Select the cell where you want the formula to go.
2. Click the “Add formula” button. A popup window opens with a list of formulas and an input field.
3. In the input field, start typing the name of the desired formula. As you type, matching formulas will appear in a drop-down list.
4. Select the formula from the drop-down list once it appears.

![Adding a formula](https://3310388157-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LEEOWDArdNNgipO8mVJ%2Fuploads%2Fgit-blob-41e74562e2f56f2adc0859604d6064553d58ea78%2Fadding_formula_button.png?alt=media)

In case the "methods" option is enabled in the SpreadSheet configuration, you can choose a formula by the category:

<figure><img src="https://3310388157-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LEEOWDArdNNgipO8mVJ%2Fuploads%2FkROUM3IRJsTSSVyaNai6%2Fimage.png?alt=media&#x26;token=4a106c4e-9c5a-435a-9ae3-eb26fb8d1597" alt=""><figcaption><p>Adding a formula by category</p></figcaption></figure>

At the end press the **Enter** button to get the result of formula calculation.

You can show formulas in cells instead of values. To do it, click on the **Hide/show formulas** button in the **View** section.

## The List of Supported Functions

SpreadSheet can work with the Excel functions. For more details on these functions, please see the [documentation](https://support.microsoft.com/en-us/office/excel-functions-alphabetical-b3944572-255d-4efb-bb96-c6d90033e188) for Microsoft Excel.

You can find the full list of functions that are supported by SpreadSheet [here](https://docs.webix.com/spreadsheet__functions.html).

## Adding Named Range

You can specify a name for a particular range of cells and then use it in formulas for calculations. Thus, the formula will be easier to understand and work with.

To add a named range:

1\) Choose one of the ways below:

* Click the **Named Ranges** button in the **Edit** section.

![Named Ranges Button](https://3310388157-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEEOWDArdNNgipO8mVJ%2F-LFIIQcybFEakywlq7iM%2F-LF6wCBHXvpblO2BIgwL%2Fnamed_ranges_button.png?generation=1529332225241476\&alt=media)

* Right-click any cell and select the *Named Ranges* option in the context menu.

![Named Range Option](https://3310388157-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEEOWDArdNNgipO8mVJ%2F-LF6wBQWvZ8AKmIkXvnd%2F-LF6wCBJr5waCT6BZNNA%2Fnamed_range_context_option.png?generation=1529141586727784\&alt=media)

2\) In the opened popup specify the desired name and add cells that will be included in the range in one of the ways below:

* Type the reference to the range as a pair of the starting and ending cells as A2:A5
* Select a range of cells in a sheet and the reference will appear in the input automatically

*Adding a range named Total for cells F2-F4*

![Named Range Popup](https://3310388157-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEEOWDArdNNgipO8mVJ%2F-LF8BGstE65DcvH5ASNw%2F-LF6wCBRnMx_2PDyqtxw%2Fnamed_range_popup.png?generation=1529162575321218\&alt=media)

3\) Click the **Save** button to save a new range. It will appear in the list of ranges in the left part of the popup.

![Saving New Named Range](https://3310388157-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEEOWDArdNNgipO8mVJ%2F-LF7P__lpw_JrLmMVxFe%2F-LF7Pbcze5sr6scEalmq%2Fsaved_named_range.png?generation=1529149557999454\&alt=media)

You can navigate between ranges using the dropdown list from the navigation input field:

<figure><img src="https://3310388157-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LEEOWDArdNNgipO8mVJ%2Fuploads%2Fhhf4QlfccJn11bnEJmH4%2Frange_select.png?alt=media&#x26;token=c3223dd9-75bc-46eb-af05-14564cbb1502" alt=""><figcaption><p>Named Ranges List</p></figcaption></figure>

Note that this list will contain only ranges with the entire book scope or the current worksheet.

### Using Named Range in Formulas

After a named range is added into a list, you can use it as an argument in a function/formula. The image below shows how the *Total\_range for cells F2-F4 is used in the \_SUM* function:

![Using Named Range in Function](https://3310388157-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEEOWDArdNNgipO8mVJ%2F-LF8BGstE65DcvH5ASNw%2F-LF6wCBYVfJCn-axxMRA%2Fusing_named_range.png?generation=1529162578276425\&alt=media)

As a result, the values of the cells F2-F4 are summed up.

![Result of Using Named Range in Function](https://3310388157-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEEOWDArdNNgipO8mVJ%2F-LF8BGstE65DcvH5ASNw%2F-LF6wCB_XFHn87B7nFVj%2Fnamed_range_result.png?generation=1529162577674347\&alt=media)

### Editing Named Range

To make changes in an existing named range:

1\) Click the **Named Ranges** button

![Named Ranges Button](https://3310388157-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEEOWDArdNNgipO8mVJ%2F-LFIIQcybFEakywlq7iM%2F-LF6wCBHXvpblO2BIgwL%2Fnamed_ranges_button.png?generation=1529332225241476\&alt=media)

2\) Apply the necessary action by clicking the corresponding icon in the line with the named range in question:

* To edit the range, click the "pencil" icon.
* To delete the range, click the "basket" icon.

![Editing Icons for Named Range](https://3310388157-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LEEOWDArdNNgipO8mVJ%2F-LF6wBQWvZ8AKmIkXvnd%2F-LF6wCBdrg5O4wtdyNSt%2Fnamed_range_edit_icons.png?generation=1529141586650462\&alt=media)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://webix-guides.gitbook.io/spreadsheet-user-guide/using_formulas.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
