Function Reference > Functions > INDEXOF
  

INDEXOF

Finds the index of a value among a list of values. By default, the match is case sensitive.

Syntax

INDEXOF( valueToSearch, string1, [string2, ..., stringN,] CaseFlag )
Argument
Required/
Optional
Description
valueToSearch
Required
String datatype. Value you want to search for in the list of strings.
string
Required
String datatype. Comma-separated list of values you want to search against. Values can be in string format. There is no maximum number of values you can list. The value is case sensitive, unless you set MatchCase to 0.
CaseFlag
Required
Must be an integer. Determines whether the arguments in this function are case sensitive. You can enter any valid expression.
When CaseFlag is a number other than 0, the function is case sensitive.
When CaseFlag is a null value or 0, the function is not case sensitive.

Return Value

1 if the input value matches string1, 2 if the input value matches string2, and so on.
0 if the input value is not found.
NULL if the input is a null value.

Example

The following expression determines if values from the ITEM_NAME column match the first, second, or third string:
INDEXOF( ITEM_NAME, ‘diving hood’, ‘flashlight’, ‘safety knife’)
ITEM_NAME
RETURN VALUE
Safety Knife
0
diving hood
1
Compass
0
safety knife
3
flashlight
2
Safety Knife returns a value of 0 because it does not match the case of the input value.