list_position
Find the position of a value in a list, where 1 is the first item. Returns a missing value if it isn't found.
Also available as array_indexof, array_position, list_indexof.
Try an expression
In Formula, enter the expression and set Output type to INTEGER.
Expression
list_position([1, 2, NULL], 2)Result
2To use your own data, replace the example values with column names. Keep format strings and other options as written.
Arguments and types
list_position(list, element)- list
- List
- element
- Any value
Supported signatures (1)
list_position(list: T[], element: T) → INTEGERThe result type can depend on the input types. See DuckDB for the full argument rules.
Things to know
If the first argument is missing, the result is NULL.
Function metadata from DuckDB, used under the MIT license.