# Count or total rows

> Count matching rows, or add up, average or find the least or most of a column.

Source: https://docs.buildcord.dev/nodes/variables-and-data/count-rows/

`data.aggregate` works something out over every matching row of a collection, without a loop.

## Settings

| Setting | What it does |
| --- | --- |
| Collection | Which collection. |
| Where | Which rows. Empty is every row. See [Find rows](https://docs.buildcord.dev/nodes/variables-and-data/find-rows). |
| Work out | How many there are, or the total, average, smallest or largest of a column. |
| Column | For all but counting: the number column. Rows where it isn't a number are left out. |
| Save as | The name to keep the answer under. The default is `total`. |

## Ways out

`out`. Turn on **If it fails** for a red way out.

## Produces

`{temp.name}`, and `{rows.count}`: how many rows matched.

## Notes

- The total of no rows is 0. The average, smallest and largest of no rows is empty.

## Example

`/tickets` replies `{temp.total} open tickets`, counting `tickets` where `status = open`.

## Related

- [Find rows](https://docs.buildcord.dev/nodes/variables-and-data/find-rows)
- [For each row](https://docs.buildcord.dev/nodes/variables-and-data/for-each-row)
