# COUNT

The COUNT function counts the number of items in a range.

### Syntax

COUNT(value1, ...valueN?) - > number

### Arguments

<table><thead><tr><th width="141.33333333333331">Arguments</th><th width="167">Datatype</th><th>Description </th></tr></thead><tbody><tr><td>value1</td><td>Node reference</td><td>The first node or number to be counted. This is a required argument.</td></tr><tr><td>...valueN?</td><td>Node reference</td><td>The additional nodes or numbers to be counted. These are optional arguments.</td></tr></tbody></table>

### Example&#x20;

Consider a scenario where you want to calculate the number of periods for which the simulations are performed for a \[Sales] node. That is if simulation period is between July and September, the result should be 3.

| Sim.Months | July | August | September |
| ---------- | ---- | ------ | --------- |

In order to calculate the number of periods, the following formula should be written in the \[COUNT] node:

<mark style="color:blue;">**`COUNT`**</mark>**` ``(`**<mark style="color:purple;">**`[Sales]`**</mark><mark style="color:blue;">**`.SIM_PERIODS`**</mark>**`)`**

{% hint style="info" %}
Refer[ \[NODE\]<mark style="color:blue;">**.SIM\_PERIODS**</mark>](https://docs.valq.com/model/formula-functions/math-functions/pages/bd9R41FrVkmuCJPGQLmc#node-.sim_periods)  to know more.
{% endhint %}

### Result

| COUNT |  3  |
| :---: | :-: |


---

# 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.valq.com/model/formula-functions/math-functions/count.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.
