# AVERAGEIF

The **AVERAGEIF** function returns the average (arithmetic mean) of values that meet a specified condition. It evaluates the given range against the defined criteria and includes only those values that satisfy the condition in the calculation.  This function is commonly used in reporting scenarios where averages need to be calculated for a subset of data, such as values above a threshold, within a range, or matching specific criteria.

### Syntax

```javascript
AVERAGEIF([Range], Condition)
```

### Arguments

Range – List of values (Required).

Condition – Condition to be checked (Required).

### Example

```javascript
AVERAGEIF([Column1],[Column2], “>20000000”)
```

In the example below, the *Average Values* measure is created using the **AVERAGEIF** function, which returns the average value of the four quarters where the values satisfy the given condition (Average>20m).

When the values do not satisfy the given condition, it returns an Error (#ERR).

<figure><img src="/files/Zq0BSj2uWAvXkH2D3xX6" alt=""><figcaption><p>Applying AVERAGEIF function</p></figcaption></figure>

### Excel equivalent

[AVERAGEIF](https://support.microsoft.com/en-us/office/averageif-function-faec8e2e-0dec-4308-af69-f5576d8ac642)


---

# 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.inforiver.com/formula-syntax/math-functions/averageif.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.
