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

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

# DIFFERENCE

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

Returns an array of items that appear in the first array but not in the second array

**Categories:** Arrays

## Syntax

```
DIFFERENCE(array1, array2)
```

## Examples

### Example 1

Input:

```json
{
  "my_action": {
    "array1": [
      1,
      2,
      3
    ],
    "array2": [
      1,
      2
    ]
  }
}
```

Formula:

```
DIFFERENCE(my_action.array1, my_action.array2)
```

Output:

```json
[
  3
]
```

## Sample actions

```json
{
  "standardLibVersion": "29",
  "actionRuntimeVersion": "4",
  "agents": [
    {
      "disabled": false,
      "name": "my action",
      "description": null,
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "array1": [
            "1",
            "2",
            "3"
          ],
          "array2": [
            "1",
            "2",
            "4"
          ]
        }
      },
      "position": {
        "x": 2265,
        "y": -16230
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "recordType": null,
      "recordWriters": [],
      "form": null,
      "cardIconName": null,
      "createdFromTemplateGuid": null,
      "createdFromTemplateVersion": null,
      "originStoryIdentifier": "kes-test:779db79df723796bdf6e92d1f6bfc714"
    },
    {
      "disabled": false,
      "name": "DIFFERENCE",
      "description": null,
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "array1_vs_array2": "=DIFFERENCE(my_action.array1, my_action.array2)",
          "array2_vs_array1": "=DIFFERENCE(my_action.array2, my_action.array1)",
          "total_differences": "=CONCAT(DIFFERENCE(my_action.array1, my_action.array2), DIFFERENCE(my_action.array2, my_action.array1))"
        }
      },
      "position": {
        "x": 2265,
        "y": -16140
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "recordType": null,
      "recordWriters": [],
      "form": null,
      "cardIconName": null,
      "createdFromTemplateGuid": null,
      "createdFromTemplateVersion": null,
      "originStoryIdentifier": "kes-test:779db79df723796bdf6e92d1f6bfc714"
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    }
  ],
  "diagramNotes": []
}
```
