---
title: TALLY
url: https://www.tines.com/docs/formulas/functions/tally/
kind: formula-function
---

*[tines.com](https://www.tines.com/llms.txt) › [Docs](https://www.tines.com/llms.txt) › [Formulas](https://www.tines.com/llm/docs/formulas.md) › [Functions](https://www.tines.com/llm/docs/formulas/functions.md)*

# TALLY

*[View on tines.com](https://www.tines.com/docs/formulas/functions/tally/)*

Counts the occurrences of each unique element within an array, accounting for case sensitivity.

**Categories:** Arrays

## Syntax

```
TALLY(array, [strict_types: FALSE])
```

## Examples

### Example 1

Input:

```json
{
  "my_action": {
    "message": [
      "dog",
      "dog",
      "cat",
      "cat",
      "cat",
      "fish"
    ]
  }
}
```

Formula:

```
TALLY(my_action.message)
```

Output:

```json
{
  "dog": 2,
  "cat": 3,
  "fish": 1
}
```

### Example 2

Input:

```json
{
  "my_action": {
    "message": [
      404,
      404,
      "404",
      505,
      "505"
    ]
  }
}
```

Formula:

```
TALLY(my_action.message, strict_types: TRUE)
```

Output:

```json
[
  {
    "key": 404,
    "count": 2
  },
  {
    "key": "404",
    "count": 1
  },
  {
    "key": 505,
    "count": 1
  },
  {
    "key": "505",
    "count": 1
  }
]
```

## Sample actions

```json
{
  "standardLibVersion": "14",
  "actionRuntimeVersion": "3",
  "agents": [
    {
      "disabled": false,
      "name": "My Action",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "message": [
            "dog",
            "dog",
            "cat",
            "cat",
            "cat",
            "fish"
          ]
        }
      },
      "position": {
        "x": 3015,
        "y": 5070
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "TALLY",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "tally": "=TALLY(my_action.message)"
        }
      },
      "position": {
        "x": 3015,
        "y": 5175
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    }
  ],
  "diagramNotes": []
}
```
