---
title: "position function in Strata | Oplema"
description: "Find where a search string first appears in text, counting from 1. Same as instr. For example, position('b' IN 'abc') returns 2."
url: "https://oplema.com/docs/strata/functions/position"
updated: "2026-11-04"
---

# position

Find where a search string first appears in text, counting from 1. Returns 0 if there is no match.

Also available as instr, strpos.

## Try an expression

In [Formula](https://oplema.com/docs/strata/prep/formula), enter the expression and set Output type to **BIGINT**.

### Expression

```
position('b' IN 'abc')
```

### Result

```
2
```

To use your own data, replace the example values with column names. Keep format strings and other options as written.

Try it live in Formula

Result
| id | result |
| --- | --- |
| 1 | 2 |

## Arguments and types

```
position(search IN string)
```

**string**

Text

**search\_string**

Text

The result type can depend on the input types. See DuckDB for the full argument rules.

## Things to know

### Missing text

```
position('b' IN NULL::VARCHAR)
```

NULL

## Related functions

[contains

Check whether text contains a search string. It also checks a list for an item, a map for a key and an unnamed struct for a value.

](https://oplema.com/docs/strata/functions/contains)[starts\_with

Check whether text begins with a given string.

](https://oplema.com/docs/strata/functions/starts-with)[split\_part

Split text at a separator and retrieve one part by its position.

](https://oplema.com/docs/strata/functions/split-part)[replace

Replace every occurrence of one piece of text with another.

](https://oplema.com/docs/strata/functions/replace)

[Browse text](https://oplema.com/docs/strata/functions#text) [DuckDB documentation](https://duckdb.org/docs/current/sql/functions/text.html#positionsearch_string-in-string)

Function metadata from DuckDB, used under the [MIT license](https://github.com/duckdb/duckdb/blob/v1.5.4/LICENSE).
