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 Apps / Split string into coll...
Power Apps
Answered

Split string into collection

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

I want to split a string from label and store it in a collection, i also want to add indexes to splitted text.

Example:

My label("Resulting_Text"is the name of the label) looks like this "E123a E143b E156f". I want my collection to have 2 columns("Index" and "Value" are the names of the columns).

Collection should look like this:

Index     Value

0            E123a

1            E143b

2            E156f

 

Pls help

Thank you

Categories:
I have the same question (0)
  • Fredrik_A Profile Picture
    3,570 Super User 2026 Season 1 on at

    Is there any reason you need a collection?

     

    You can create records with the help of a varabile: 

    StretchFredrik_0-1661502519296.png

     

  • Fredrik_A Profile Picture
    3,570 Super User 2026 Season 1 on at

    If you want a collection try looking at this thread:

     

    https://powerusers.microsoft.com/t5/Building-Power-Apps/split-string-into-collection/td-p/764556

  • Verified answer
    timl Profile Picture
    36,774 Super User 2026 Season 1 on at

    @Anonymous 

    Here's a formula to do this:

    ClearCollect(
     yourCollection,
     With(
     {
     data: Split(
     "E123a E143b E156f",
     " "
     )
     },
     AddColumns(
     RenameColumns(
     Sequence(CountRows(data)),
     "Value",
     "Index"
     ),
     "Value",
     Index(
     data,
     Index
     ).Result
     )
     )
    )

    With the formula above, you would substitute the hardcoded value "E123a E143b E156f" with a reference to your label control (eg label1.Text).

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @timlyou are a life savior. Thanks!!!

     

  • timl Profile Picture
    36,774 Super User 2026 Season 1 on at

    You're welcome @Anonymous - glad to help!

  • NidjoJohnny22 Profile Picture
    288 on at

    Hi @timl , I don't understand what does the last part of the AddColumns() function do?

    Index( data, Index ).Result

  • timl Profile Picture
    36,774 Super User 2026 Season 1 on at

    @NidjoJohnny22 

    That's the part that retrieves the value (eg, E123a). The Split function splits the input into rows so the call to index is required to retrieve the corresponding value by ordinal number.

  • NidjoJohnny22 Profile Picture
    288 on at

    @timl thank you for quick reply! I understand it now 🙂 

  • rugitola Profile Picture
    5 on at

    @timl  If I use your formula as-is (or changing to my label control) it presents the error:
    The function 'AddColumns' has some invalid arguments

    Any thoughts why this might be the case?

  • rugitola Profile Picture
    5 on at

    I replaced 

    ).Result

    with 

    ).Value

    and working perfectly now.   Thanks for the solution @timl!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard