INDEXOF()

Steve
Platinum 4
Platinum 4

What is the index of the first occurrence of value in list (a list that uses delim as the element separator)?

COUNT(
SPLIT(
ANY(
SPLIT(
(delim & list & delim),
(delim & value & delim)
)
),
delim
)
)

For example:

COUNT(
SPLIT(
ANY(
SPLIT(
(" , " & LIST(1, 2, 3, 4, 5) & " , "),
(" , " & 3 & " , ")
)
),
" , "
)
)

Or:

COUNT(
SPLIT(
ANY(
SPLIT(
(" , " & [EnumList] & " , "),
(" , " & [Enum] & " , ")
)
),
" , "
)
)

 

17 7 1,077
7 REPLIES 7

This simple expression is so sweet! ๐Ÿ˜€๐Ÿ˜€

Thank you @Steve  for sharing.

 

@takuya_miyai 

 

To extend and alter this expression a bit, we can use as replacement for IN expression ...

contains(
(" , " & [EnumList] & " , "),
(" , " & [Enum] & " , ")
)

Tons of usages with this.  I already love this.

@takuya_miyai 

Thanks much Steve!! This is very useful, and as usual, I'm enjoying the simplistic creativity in your expressions ๐Ÿ™‚ 

An awesome, clever, elegant and impresive idea.

I'm stealing it ๐Ÿ˜‚

Brilliant!

@Steve thank you so much for this. Just used it to make a numbered list in an email template after racking my brain for hours how to get it done. You're the man!

That sure is useful ! Thanks

Top Labels in this Space