INDEXOF()

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] & " , ")
      )
    ),
    " , "
  )
)
19 Likes

This simple expression is so sweet! :grinning_face: :grinning_face:

Thank you @Steve for sharing.

@takuya_miyai

2 Likes

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

4 Likes

Thanks much Steve!! This is very useful, and as usual, I’m enjoying the simplistic creativity in your expressions :slightly_smiling_face:

1 Like

An awesome, clever, elegant and impresive idea.

I’m stealing it :joy:

2 Likes

Brilliant!

1 Like

@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