GetValueIndex ( valueList , valueString , matchCase , occurrence )
GetValueIndex returns the index number of the first matching valueString in the valueList. Returns 0 if not found. Toggle case-sensitive searching by passing a boolean through matchCase. And, search for a specific valueString occurrence (a negative occurrence number causes backward search from the end of the valueList).
- valueList – List of values against which valueString will be compared.
- valueString – Text of value to look for in valueList.
- matchCase – Boolean true forces valueString to be an exact case-sensitive match in valueList before returning an index nummber.
- occurrence – Directs which instance of the valueString is required to be found. A negative number causes a backward search from the end of valueList.
- ValueListIndex (“Alpha¶Bravo¶Charlie¶Echo”, “charlie”, False, 1) = 3
- ValueListIndex (“Alpha¶Bravo¶Charlie¶Echo”, “charlie”, True, 1) = 0
- ValueListIndex (“Danial¶Daniel¶Bill¶daniel¶Frank¶daniel¶Ed”, “Daniel”, True, -1) = 2
This function is a recursive function. If you change the name of it, then change the name references inside the code.
GetValueIndex code: Copy the selected code (click on Select All to highlight all the code) to the clipboard and paste it into a newly created Custom Function. Download code as a text file from here.