# SUMIF

The SUMIF function adds the values in a list that match a specified condition.&#x20;

## Syntax

```javascript
sumif([list],condition,[range])
```

## Arguments

list – Required. An array of numbers to iterate through.

condition – Required. The numbers are summed up if they meet the condition specified in this argument.

range - Optional. An array of numbers that will be summed if the numbers in the list array meet the condition. If a range argument is not given, the array or numbers in the list argument are summed up.

## Example

```javascript
sumif([10,20,30], ">50", [cell1, cell2,...cellN])
```

Returns the sum of cell1 to cell n.

**Example 1:**

In this example, we have not passed the 3rd range parameter. If the sum of the highlighted cells exceeds 20m, then the same cells are summed up.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2F90KZumj9VC6Ou1XVkhiK%2Fimage.png?alt=media&#x26;token=3c4f7f4f-91fc-464e-98a2-123e0965e458" alt=""><figcaption><p>SUMIF without a range parameter</p></figcaption></figure>

**Example 2:**

This is another way to use SUMIF without passing the range parameter. If the sum of the actuals and plan exceeds 20m, then the actuals and plan are summed up for each row. When the condition is not met, SUMIF yields 0.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FJPsgA03iL0r35EhHEtf8%2Fimage.png?alt=media&#x26;token=94c3634c-7d20-44d6-a12e-e089a0b86bf9" alt=""><figcaption><p>SUMIF for each row without a range parameter </p></figcaption></figure>
