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 / Alphabetize a split te...
Power Apps
Answered

Alphabetize a split text column alphabetically

(0) ShareShare
ReportReport
Posted on by

Hello,

 

I'm having trouble alphabetizing text columns that are split by semicolons either in Ascending or Descending order. What am I missing in the formula below? Thanks in advance for your help. Teresa

 

SortByColumns(Split(ddHiringMgrNH.Selected.Shifts,";"),"Result", Descending)

 

SplitA-Z.png

Categories:
  • WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at

    Hi @tagustin ,

    This should work as long as your selected item (single text value) contains a text string AND the separation has not spaces (Value1; Value2; Value3)

    Sort(
     Split(
     ddHiringMgrNH.Selected.Shifts,
     ";"
     ).Result,
     Result
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

     

     

  • tagustin Profile Picture
    on at

    @WarrenBelz 

     

    Hello Warren,

     

    Thank you for the formula suggestion. I tried it, but unfortunately it doesn't work due to the fact that a couple of the shifts have spaces in them. I really don't want to remove the spaces so is there a way to adjust the formula to account for them?

     

    Shift Dropdown.png

     

     

  • WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at

    Hi @tagustin ,

    Spaces in the middle should not affect it - what exactly does the string you are trying to separate look like?

  • Verified answer
    ansrikanth Profile Picture
    329 on at

    Hi @tagustin , Add a Trim in the middle as shown below.. 

     

    Sort(Trim(Split("Swing; Day; WE Night; WE Day",";")),Result,Descending)

     

    It should show the result as 

    ansrikanth_0-1646948885640.png

     

    Thank you

    -Srikanth

    (Please mark the answer and close the thread to help others as well...)

  • WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at

    @ansrikanth ,

    This is nothing to do with spaces in the middle (in fact they are needed by @tagustin 's response) - I was only ensuring the separator did not have a space in it (; )

  • ansrikanth Profile Picture
    329 on at

    @WarrenBelz when there are spaces in the string after seperator as shown in my code window, it actually considered the leading space as part of the string it self and so if you see the image from @tagustin it is showing the first one with outspace on top and rest of the items with space sorted in descending...

    By using trim, it removed all leading spaces and sorted them in descending as shown in my image.

    I have tested it and was able to repeat the behaviour.

     

    Hope that makes sense 🙂

    Thank you

     

     

     

     

     

     

  • ansrikanth Profile Picture
    329 on at

    Btw, I'm not removing the space with in the string (combovox item) it self.. if you see my image I have retained the space between WE and Night..

  • tagustin Profile Picture
    on at

    @ansrikanth 

    @WarrenBelz 

     

    Hello,

     

    Thank you both for your responses. While I definitely plan to keep both of your formula suggestions for future reference, I don't believe the Trim as written will solve my issue since each line item in the data source is different. Some of our managers only have an "Office" shift, one manager only has a "Swing" shift, etc. so I can't really hardcode the shifts into the formula. Is there a way to achieve what I am looking for in a more dynamic way?

     

    You can probably already tell by the screenshot below, but just to verify, my column is a single line of text type column.

     

    2022-03-10_18-21-18.png

     

    Kind regards,

    Teresa

  • WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at

    Hi  @tagustin ,

    Please tag whoever you want to respond here - three-way conversations just confuse everyone . . .

  • ansrikanth Profile Picture
    329 on at

    I understand @tagustin , in my formula I have it as an example and prove my self before posting.. I didn't mean to hard code it either. If you use Trim in your formula it should definitely work for you after looking at you screenshot I'm more confident on this ☺️

     

    There is another alternate, in your data source change Day; Swing; WE Day; WE Night to Day;Swing;WE Day;WE Night. Then with out changing any formula it should work as expected.

     

    Thank you- Srikanth

     

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard