---
title: INDEX_OF
url: https://www.tines.com/docs/formulas/functions/index-of/
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)*

# INDEX_OF

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

Returns the index of the specified term within the provided string or array. With arrays you can provide a LAMBDA as the second argument, and the index of the first matching result it returned.

**Categories:** Arrays, Text

## Syntax

```
INDEX_OF(string_or_array, object | LAMBDA(value, expr))
```

## Examples

### Example 1

Input:

```json
{
  "my_action": {
    "data": [
      "foo",
      "bar"
    ]
  }
}
```

Formula:

```
INDEX_OF(my_action.data, "foo")
```

Output:

```json
0
```

### Example 2

Input:

```json
{
  "my_action": {
    "string": "foobar"
  }
}
```

Formula:

```
INDEX_OF(my_action.string, "bar")
```

Output:

```json
3
```

### Example 3

Input:

```json
{
  "my_action": {
    "data": [
      "foo",
      "bar"
    ]
  }
}
```

Formula:

```
INDEX_OF(my_action.data, "cat")
```

Output:

```json
null
```

### Example 4: Use LAMBDA with arrays to return the index of the first matching value

Input:

```json
{
  "my_action": {
    "data": [
      1,
      2,
      3,
      4,
      5
    ]
  }
}
```

Formula:

```
INDEX_OF(my_action.data, LAMBDA(value, value > 2))
```

Output:

```json
2
```
