Sometimes when working with lists, you find yourself needing to know at what position an item sits in a list.
Iโve put together a sample app that demonstrates how to find such things:
The real magic is with the following formula (which Iโve cleaned so itโs โuniversalโ)
count(
split(
left(
concatenate(ENTER_LIST_HERE),
find(
WHAT_TO_FIND,
concatenate(ENTER_LIST_HERE)
) + (LEN(WHAT_TO_FIND) - 1)
),
" , ")
)
Replace the placeholders with the appropriate data:
Other posts from the community that literally answer the same thing, but that didnโt pop up when I was making my post - and people canโt seem to find when asking a question with the keywords:
โlistโ
โindexโ
โpositionโ
Maybe people will be able to find the answer now???
Now THAT is an expression. Bookmarking it for later, thanks Matt !
Such a juicy expression
Just a note on this tip.... If the value is not in the list it will return position 1. You may want to start with something like IFS(IN(xxx,list),expressionabove) to improve this excellent tip
Very creative ! I had not notice that we can have any type as CONCATENATE's argument, even been clear in the function documentation:
And, for anyone who lands here seeking a streamlined way to identify the index (position) of a row among multiple rows, here's the technique I'm using--fortunately much more straightforward find the index of an item within a list.
COUNT(SELECT(Table/SliceName[AnyColumnName], [_RowNumber] <= [_THISROW].[_RowNumber]))
If you can depend on the group of rows being contiguous in the table's data source, here's an even simpler version:
[_RowNumber] - MIN(Table/SliceName[_RowNumber]) + 1
Friend, you outdid yourself, you are a genius, thank you very much