# SUMIF

The **SUMIF** function returns the sum of values in a list that satisfy a specified condition.

### Syntax <a href="#syntax" id="syntax"></a>

<pre class="language-javascript"><code class="lang-javascript"><strong>SUMIF(list, condition, [range])
</strong></code></pre>

### Arguments

* *list*: The list of values to evaluate.
* *condition*: The condition used to filter values in the list.
* *range* (Optional): The list of values to sum if the values in the *list* meet the condition. If not specified, the values in the original *list* are summed.

### Return value

Returns the sum of values that satisfy the condition.

### Example  <a href="#example" id="example"></a>

#### 1. Without Range <a href="#example" id="example"></a>

<pre class="language-javascript"><code class="lang-javascript"><strong>SUMIF([10, 20, 30, 40], ">20")
</strong></code></pre>

In this example, the **SUMIF** function returns the sum of values greater than 20 from the list and returns 70 (30 + 40).

#### 2. With Range <a href="#example" id="example"></a>

<pre class="language-javascript"><code class="lang-javascript"><strong>SUMIF([10, 20, 30, 40], ">20", [1, 2, 3, 4])
</strong></code></pre>

The **SUMIF** function evaluates the values in the first list and returns the sum of corresponding values from the second list where the condition is met. In this example, the result is 7 (3 + 4).


---

# 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.fabricplan.com/planning-sheets/formula-syntax/conditional-statements/sumif.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.
