Index values ​​from a list of non-consecutive ordered numbers

 

Dear community members, today I have the following question. Let's assume a list like the following:

LIST(1 , 2 , 5 , 7 , 9 , 13 , 15)

I want to find the location of the elements in the list. For the case I describe it would be:

1 = 1
2 = 2
5 = 3
7 = 4
9 = 5
13 = 6
15 = 7


With FIND() I could improvise something from 1 to 9 but after 9 it gets complicated since it analyzes exact matches and, unfortunately, does not consider separators.

Have any of you ever needed something like me? If so, would you be so kind as to explain to me how to proceed?

Solved Solved
0 2 99
1 ACCEPTED SOLUTION

2 REPLIES 2

Thanks @TeeSee1 ! Actually, I had tried the expression from this post https://www.googlecloudcommunity.com/gc/Tips-Tricks/How-to-find-the-Index-position-of-an-item-from-a... and it also works. But I've been analyzing since both give the same result, Steve's expression seems to impact performance less as it involves fewer operations and delimits with ANY() many elements which could mean a performance improvement with larger data volumes. Thanks again for your answer and I was able to solve it.

 

Top Labels in this Space