> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://help.sigmacomputing.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://help.sigmacomputing.com/_mcp/server.

# SumIf

> Use the Sigma SumIf function to add the numbers in a column if all conditions are True for that row.

The **SumIf** function adds the numbers in a column if all conditions are `True` for that row.

The **SumIf** function is an aggregate function.

Aggregate functions evaluate one or more rows of data and return a single value.

In a table element, the aggregate is calculated for each grouping. For information on how to add a grouping with an aggregate calculation to a table, see [Group columns in a table](/docs/create-and-manage-tables#group-columns-in-a-table).

In a table with no groupings, the aggregate is calculated for each row. For information on how to calculate summary statistics across all rows in a table, see [Add summary statistics to a table](/docs/create-and-manage-tables#add-summary-statistics-to-a-table).

To learn more about using aggregate functions, see [Building complex formulas with grouped data](https://www.sigmacomputing.com/resources/training-videos/table-grouping-and-functions#complex-formulas).

## Syntax

`SumIf(field, condition 1, [condition 2], ...)`

Function arguments:

* **field** (required) - The column of numbers to add together. Null values are skipped.
* **condition 1** (required) - The logical condition that returns a result that is either True or False. If the condition is True, the number on the corresponding row is added to the sum. You can use [operators](/docs/operators-overview) in conditions.
* **condition 2 +** (optional) - Additional conditions can be added after the first condition.

## Notes

* When using **SumIf** with multiple conditions, the function uses the logical operator `AND` by default to combine them. This means that all conditions must be true in order for the row to be counted. To use other [operators](/docs/operators-overview), such as `OR`, you must explicitly state them in a condition.
  * For example, `SumIf([Sales], [Store State] = "Michigan" or [Store State] = "California")` sums the values in the *Sales* column for the rows where the *Store State* column has a value of `Michigan` or `California`.
* When using **SumIf** on a column with the logical data type, you can optionally omit the comparison operator and value.
  * For example, `SumIf([Score], [Submitted] = True)` is equivalent to `SumIf([Score], [Submitted])`.

## Examples

```
SumIf([Sales], [State] = "TX" )
```

Returns the sum values in the *Sales* column if the *State* column value is `TX`.

```
SumIf([Sales], [State] = "TX" OR [State] = "CA")
```

Returns the sum of values in the *Sales* column if the *State* column value is `TX` or `CA`.

```
SumIf([Sales], [State] = "TX", [CustomerID] = "1234" )
```

Returns the sum of values in the *Sales* column if the *State* column value is `TX` and the *CustomID* column value is `1234`.

```
SumIf([Sales], [State] = [list-control-state])
```

Returns the sum of values in the *Sales* column if the *State* column value matches the value selected in the *list-control-state* control element.

## Related resources

* [Sum](/docs/sum)
* [If](/docs/if)