# Use formulas

{% hint style="info" %}
User permission: Budgets & Forecasts
{% endhint %}

{% hint style="warning" %}
Take care when referencing totals in a filtered workbook or one with hidden cells due to database restrictions. The total might not respect the filter, resulting in incorrect calculations. When the filter or restriction is removed, the result might also change unexpectedly.

For example, if you’re restricted to one dimension entity and create a formula using *Net profit*, the formula will calculate correctly for that entity. However, if the restriction is later removed (for example, when someone without the restriction opens the workbook), the formula will instead use the total *Net profit*.

To prevent this, the administrator should turn on [nested calculations](/budgets-and-forecasts/getting-started/overview-of-key-terms-and-concepts/relationship-with-the-financial-statements-module.md#nested-calculation-rows), and you should reference the *Net profit* value for the specific dimension entity you have access to.&#x20;
{% endhint %}

You can enter formulas into the cells in a worksheet. These formulas can reference cells in different worksheets, working rows or comparison rows. Rather than including more complex spreadsheet functions, Budgets & Forecasts keeps a level of simplicity by allowing for basic arithmetic in these formulas.

{% embed url="<https://phocassoftware.wistia.com/medias/i3y0m7zekm>" %}
Use formulas
{% endembed %}

## Enter a basic formula <a href="#useformulas-enterabasicformula" id="useformulas-enterabasicformula"></a>

You enter formulas in a similar way to how you do it in other spreadsheet software, such as Microsoft Excel or Google Sheets, either directly into a cell or in the **fx** (formula) bar at the top of the grid when the cell is selected.

It is easy to identify and understand formulas. When a cell contains a formula, the cell value has a blue **fx** indicator next to it. You can hover over this indicator to view the formula or click a cell and view the formula in the **fx** bar.

<div align="left"><figure><img src="/files/M1g9pt6154g6rGnHbNoX" alt="" width="374"><figcaption></figcaption></figure></div>

## Use operators <a href="#useformulas-useoperators" id="useformulas-useoperators"></a>

When you enter or edit an operator in a formula, a list of available operators displays. You can either use this list as a reference, so you know which operators you can use, or click the required operator to insert it into the formula.

<div align="left"><figure><img src="/files/sAo2AthGYvWZaHBA6HHV" alt="" width="102"><figcaption></figcaption></figure></div>

## Reference other cells in formulas <a href="#useformulas-referenceothercellsinformulas" id="useformulas-referenceothercellsinformulas"></a>

To enter more advanced formulas, you can reference values in other cells in the same worksheet (including those in comparison, sum and working lines) and in other worksheets (such as driver tabs).

{% hint style="info" %}
When you view a formula in the **fx** bar, a description of the referenced cells display, along with a colored dot corresponding to those cells. So you can easily see what you’re calculating, rather than just a reference to a cell number.
{% endhint %}

<div align="left"><figure><img src="/files/35TLbKu0tTCaVJo2Bt3G" alt="" width="510"><figcaption></figcaption></figure></div>

When you copy and paste cells that contain formulas, you can control how those formulas behave. In the majority of cases, the cell references are relative by default but you can switch to absolute references, if required. See the **Copy and paste formulas (relative v absolute references)** section below.

The following examples might be useful in your budget or forecast worksheet.

<details>

<summary>Example 1: Reference a cell within the same worksheet</summary>

Your IT Computer Costs are a function of wages. In the formula below, the IT costs are 2% of AU wages.

<img src="/files/NsZ3SxR4L7O3DXsCB99M" alt="" data-size="original">

</details>

<details>

<summary>Example 2: Reference a cell in another worksheet</summary>

You added a **Manual Entry Driver** tab (which is named **Assumptions**) in which you entered an AUD exchange rate. You want to use that rate to calculate the budgeted cost of the Australian Conference. In the formula below, the Conference - AUD value is multiplied by the exchange rate in the **Assumptions** tab.

<img src="/files/Bo09z8Wn2XQgFv9vkUtC" alt="" data-size="original">

</details>

<details>

<summary>Example 3: Reference a cell in a comparison row</summary>

You want the Sales budget values for this year to be ten percent higher than last year’s actuals. In the formula below, the April 2021 sales value is made up of the actual value from 2021 plus ten percent.

<img src="/files/yiTvxkJqqzaCCQNRdxlg" alt="" data-size="original">

</details>

## Use functions in formulas

You can use several [functions](/other-information/functions-for-use-in-formulas.md) in your formulas.&#x20;

### Enter a function

You enter functions in the same way you do in other worksheet software. The general steps are as follows:

1. Select the cell in which you want to enter the function.
2. Press the **Equals =** key to indicate that you're entering a function.
3. Either click the blue down arrow next to the formula box and select a function from the list, or start typing the name of the function you want to use. As you type, a list of function names displays based on what you've entered so far.
4. Select the required function from the list (or continue typing the function name).
5. Press the **Open parentheses (** key to indicate the beginning of the function's arguments, which are the cells of data on which the function operates.
6. Select the arguments (reference cells). You can separate multiple arguments with commas or use your keyboard to select a range of arguments.\
   See [Use a range in a function](#use_range) below for more information.\
   See [Functions > SUM](/other-information/functions-for-use-in-formulas.md#sum-flex-modes-and-budgets-and-forecasts) for examples of the different ways to select the arguments.
7. Press the **Close parentheses )** key to indicate the end of the function's arguments.
8. Press **Enter** or **Return** to complete the function entry. The result of the function displays in the cell where you entered it.
9. (Optional) [Switch to absolute or relative references](#switch_reference), if required.

### Use a range in a function <a href="#useformulas-use_rangeusearangeinafunction" id="useformulas-use_rangeusearangeinafunction"></a>

You can reference a range of cells in functions. In most cases, the ranges can only be on a single row. For example, you can sum across a row but not down a column.

Functions that accept cell ranges are:

* SUM, MIN, MAX and AVERAGE. You can use the **Shift**+**Arrow** keys to select the range.
* DAYS, WEEKDAYS, WORKINGDAYS and WD. Currently, you can only select a range for these functions using the mouse method (not via the keyboard).

See [Functions > SUM](/other-information/functions-for-use-in-formulas.md#sum-flex-modes-and-budgets-and-forecasts) for examples of the different ways to select a range of cells.

## Copy and paste formulas (relative v absolute references) <a href="#useformulas-learnaboutthefunctions" id="useformulas-learnaboutthefunctions"></a>

To save time, you can [copy and paste](/budgets-and-forecasts/contributor/edit-values-in-a-worksheet/copy-and-paste-values.md) formulas. When you copy a formula, the pasted formula might have an absolute or relative reference, depending on the situation, as outlined below. You can quickly switch between these reference types to meet your formula needs.

### Use relative referencing <a href="#useformulas-userelativereferencing" id="useformulas-userelativereferencing"></a>

With relative referencing, the cell references adjust automatically in the target cell. In other words, the references change when the formula is copied into other cells, relative to the position (row and column) of the formula.

In the following example, the formula in **DL** > **September 2022** cell references the value in the **FL** > **September 2022** cell. When that formula is copied into the next cell, the reference is relative (the month changes), so the reference part of the formula changes to become **FL** > **October 2022**.

<div align="left"><figure><img src="/files/gLYAtdchbCHVVCT0b4hQ" alt="" width="544"><figcaption></figcaption></figure></div>

When you copy formulas in a budget or forecast worksheet, the cell references in the target cells are **relative by default** in the following situations:

* When you use the copy forward feature. For example, if a cell references January data, when you copy the cell to February, it will reference February data.
* When you copy a formula that references a comparison row. This applies both to formulas copied to the same row and to different rows from the original cell.
* When you copy a formula that references a working row. For example, if the original cell has two working rows and a formula references both of those rows, copying the formula to a cell which has two or more working rows will result in a relative formula being pasted into the target cells. The target cells need to have the same working row offset.
* When you copy a formula that references a cell in one level into a target cell in a different entity in the same level. For example, if you copy a formula in Branch A’s Cost of Goods Sold, which references sales in Branch A, and paste it into Branch B’s Cost of Goods Sold, the formula will reference to Branch B’s sales.

### Use absolute referencing <a href="#useformulas-useabsolutereferencing" id="useformulas-useabsolutereferencing"></a>

With absolute referencing, the cell references are locked. In other words, the references don't change when the formula is copied into other cells.

When you copy formulas in a budget or forecast worksheet, the cell references in the target cells are **absolute by default** in only one situation; when you copy forward a cell in the **Total** column, i.e. the formula will always reference the total.

You can change the default relative references listed above to absolute references (see next section below). Following on from the example above, if you manually switch to absolute referencing, you can see the dollar sign in the formula denotes the absolute reference, and the reference part of the formula is the same in both cells; **FL** > **September 2022**.

<div align="left"><figure><img src="/files/7USQpGy3ULm3qMQxLuOm" alt="" width="544"><figcaption></figcaption></figure></div>

### Switch from relative to absolutive referencing (or vice versa) <a href="#useformulas-switch_referenceswitchfromrelativetoabsolutivereferencing-orviceversa" id="useformulas-switch_referenceswitchfromrelativetoabsolutivereferencing-orviceversa"></a>

To switch (toggle) between absolute and relative references, in both a single cell reference and the components of a range, you use the **F4** key.

1. Enter the formula into the required cell, then in the formula bar, select the reference element of that formula.
2. Press **F4**. A dollar sign displays next to the element (date) in the formula to identify it is an absolute reference.
3. Click out of the formula bar and press **Enter** to view your changes.
4. Copy the formula as required and note how the values change.

   <div align="left"><figure><img src="/files/VH5gkkBEld5U6YKjDV8p" alt="" width="510"><figcaption></figcaption></figure></div>

<details>

<summary>Example: Switch from a relative to absolute referencing in a function that references a range of cells</summary>

In the image below, the formula uses a function that references a range of cells. That formula was copied forward into the other cells in the row. By default, relative referencing applies. When you press **F4** to switch to absolute referencing, the reference to the first cell in the range becomes absolute, as illustrated in the second image below. Note the difference in the values in the subsequent cells.

<img src="/files/OpQoITMGfCnp1UevRSrs" alt="" data-size="original">

If you press **F4** again (2nd time), all the references become absolute, as illustrated in the image below.

<img src="/files/ggOy0G4skVhrJwNHmD6k" alt="" data-size="original">

If you press **F4** again (3rd time), the reference to the other cells in the range become absolute, as illustrated in the image below.

<img src="/files/rJByPxb1plSVrvpGJZIO" alt="" data-size="original">

If you press **F4** again (4th time), you return to how you started; relative referencing applies again. So you can quickly switch between the different types of referencing to control how the values are copied into the other cells.

</details>

Watch this video for a demonstration:

{% embed url="<https://phocassoftware.wistia.com/medias/esxjjs9mts>" %}


---

# 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://docs.phocassoftware.com/budgets-and-forecasts/contributor/edit-values-in-a-worksheet/use-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.
