web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Finding the index of a...
Power Automate
Unanswered

Finding the index of a value in a list

(0) ShareShare
ReportReport
Posted on by

Apologies if this is a repeat, I couldn't find an equivalent for this as almost all seemed to refer to excel. I have a list containing values, and I wish to find where in the list a particular value is, so if my list was A,B,C,D,E and I was looking for C it would return 2 (given that indexes start at 0 in PAD). I've tried looping through the list until the variables match, and incrementing a list location variable by 1 each time, which works but is very slow and I have to carry out a lot of these, does anyone know a faster way?

 

I tried adding to a data table and using the "Find or replace in data table" function but as it's only single column it just reverts to being a list again.

 

Any advice appreciated, thank you in advance.

I have the same question (0)
  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    I suggest doing some text operations on the list.

    Try joining it into a string using some delimiter that would never be in your values - e.g. ';;;'. Then split the resulting string into a new list by using the value you are looking for as the delimiter. This will result in a list of two strings. Then pick the first one and split it again by using the same delimiter you originally used for joining the initial list (';;;'). The resulting list will have a count of items that equals the index of the value you were looking for in the initial list.

     

    See a sample flow here:

    Agnius_0-1689743555657.png

    And here's a snippet you can copy and paste to PAD to create the actions automatically:

    SET List TO ['Abc', 'Bcd', 'Cde', 'Def', 'Efg']
    SET ValueToFind TO $'''Cde'''
    Text.JoinText.JoinWithCustomDelimiter List: List CustomDelimiter: $''';;;''' Result=> JoinedText
    Text.SplitText.SplitWithDelimiter Text: JoinedText CustomDelimiter: ValueToFind IsRegEx: False Result=> TextList
    Text.SplitText.SplitWithDelimiter Text: TextList[0] CustomDelimiter: $''';;;''' IsRegEx: False Result=> SlicedList
    SET Index TO SlicedList.Count

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 282 Super User 2026 Season 2

#2
trice602 Profile Picture

trice602 159 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 146 Super User 2026 Season 2

Last 30 days Overall leaderboard