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

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Alphabetize a split te...
Power Apps
Unanswered

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:
I have the same question (0)
  • WarrenBelz Profile Picture
    152,845 Most Valuable Professional on at
    Re: Alphabetize a split text column alphabetically

    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
    Re: Alphabetize a split text column alphabetically

    @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
    152,845 Most Valuable Professional on at
    Re: Alphabetize a split text column alphabetically

    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
    Re: Alphabetize a split text column alphabetically

    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
    152,845 Most Valuable Professional on at
    Re: Alphabetize a split text column alphabetically

    @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
    Re: Alphabetize a split text column alphabetically

    @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
    Re: Alphabetize a split text column alphabetically

    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
    Re: Alphabetize a split text column alphabetically

    @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
    152,845 Most Valuable Professional on at
    Re: Alphabetize a split text column alphabetically

    Hi  @tagustin ,

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

  • ansrikanth Profile Picture
    329 on at
    Re: Alphabetize a split text column alphabetically

    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard