+ Reply to Thread
Results 1 to 18 of 18

Sorting Text within a cell

  1. #1
    Registered User
    Join Date
    07-27-2021
    Location
    US
    MS-Off Ver
    MS365
    Posts
    6

    Sorting Text within a cell

    Hi all,

    Does the function to sort text within a cell exist or a work around. Currently my idea is to break them into multiple cells, transpose, sort transpose again, and recombine. I think this is possible but will take much time and resources as I am currently working with at least 30 thousand line. Would appreciate any help on this... even a VBA solution would be great if that is the only possible way!

    Example cell: (within a cell) Orange Apple Banana Pineapple Grape
    Desired result: Apple Banana Grape Orange Pineapple

    background of problem: I need to compare data between two worksheet. However, no common data between the two data set except name is available. The issue is the name format is different (last, middle, first, etc) and inconsistent (some has . and between 2 to 5 names). My solution is to sort the name column in both worksheet to get a common denominator to work with.


    Thanks in advance! Hope every one stays safe in this pandemic times. Cheers

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Sorting Text within a cell

    Welcome to the forum.

    Your Excel version is MS365 (days in a year) not 360 (degrees in a circle) - please update your profile.

    I think you will need VBA.Have a look here: https://www.excelforum.com/excel-gen...ular-cell.html
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Taiwan
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,382

    Re: Sorting Text within a cell

    Office 365
    Suppose your within a cell is in cell A1
    cell B1 formula

    HTML Code: 

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Sorting Text within a cell

    Oooh, nice one!

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Sorting Text within a cell

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  6. #6
    Registered User
    Join Date
    07-27-2021
    Location
    US
    MS-Off Ver
    MS365
    Posts
    6

    Re: Sorting Text within a cell

    Thank you for pointing that out! i have looked at the linked prior to posting. Unfortunately it would not work with my data set. As the text would need to be separated by a comma between each word. I am trying to understand the VBA code that determines the comma as the separator but no luck so far. Thank you!

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Sorting Text within a cell

    Did you see post #3?

    You did not tell us in your opening post that you wanted to separate the text with a comma - how did you expect us to guess that???

    Try changing this:

    TEXTJOIN(" ",TRUE,SORT(FILTERXML("<A><B>"&SUBSTITUTE(A1," ","</B><B>")&"</B></A>","//B")))

    to this:

    TEXTJOIN(",",TRUE,SORT(FILTERXML("<A><B>"&SUBSTITUTE(A1," ","</B><B>")&"</B></A>","//B")))

  8. #8
    Registered User
    Join Date
    07-27-2021
    Location
    US
    MS-Off Ver
    MS365
    Posts
    6

    Re: Sorting Text within a cell

    @wk9128

    Thank you for your reply! i appreciate it very much. however I can get it to work. it says "sort" is not a valid function
    Last edited by AliGW; 07-27-2021 at 02:34 AM. Reason: PLEASE don't quote unnecessarily!

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Sorting Text within a cell

    In that case, you do NOT have MS365!!!

    https://support.microsoft.com/en-us/...d-c20e8e44b86c

    So which version do you have???

  10. #10
    Registered User
    Join Date
    07-27-2021
    Location
    US
    MS-Off Ver
    MS365
    Posts
    6

    Re: Sorting Text within a cell

    @AliGW

    sorry for the confusion. I do not want a comma. I meant the solution to the link you shared would not work as the problem in that link uses a comma as a separator. Since my data set does not, it would require a different approach or some modification to the VBA code.
    Last edited by AliGW; 07-27-2021 at 02:33 AM. Reason: PLEASE don't quote unnecessarily!

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Sorting Text within a cell

    Please see and respond to post #9.

    You are causing confusion on an industrial scale and in the process wasting our time.

  12. #12
    Registered User
    Join Date
    07-27-2021
    Location
    US
    MS-Off Ver
    MS365
    Posts
    6

    Re: Sorting Text within a cell

    im sorry for wasting your time. Im running it on a company laptop. Under account it says subscription product : microsoft office 365 ProPlus. So i dont know what other version it could be. Im just trying to get some help on a subject i have limited knowledge on. Would appreciate if you could be more patient
    Last edited by AliGW; 07-27-2021 at 02:51 AM. Reason: PLEASE don't quote unnecessarily!

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Sorting Text within a cell

    Right - it looks like the version of 365 you are running is not up-to-date, then.

    Would appreciate if you could be more patient
    I will leave this to someone else to answer. Good luck!

  14. #14
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,151

    Re: Sorting Text within a cell

    It would (will!) help if you can post a sample workbook.

    See the yellow banner at top of the page on how to attach a workbook.

  15. #15
    Valued Forum Contributor
    Join Date
    06-23-2021
    Location
    Romania
    MS-Off Ver
    2021, 365 v 2208
    Posts
    722

    Re: Sorting Text within a cell

    I found this thread in this forum.
    https://www.excelforum.com/excel-gen...ular-cell.html
    Maybe this is what you need.
    Diana Tanase


    If the solutions offered helped you to solve your problem, then mark the thread as SOLVED (thread tools in the top menu) and you can click on * to add reputation to those who helped you, as a way to say thank you !

  16. #16
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Sorting Text within a cell

    Diana - I already posted that link in post #2. The OP has rejected it.

  17. #17
    Valued Forum Contributor
    Join Date
    06-23-2021
    Location
    Romania
    MS-Off Ver
    2021, 365 v 2208
    Posts
    722

    Re: Sorting Text within a cell

    Ali, you're right. It got out of my sight

  18. #18
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Sorting Text within a cell

    No worries.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Sorting cell content based on text within text?
    By vendo_23 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-24-2020, 02:28 AM
  2. [SOLVED] Sorting through text in single cell
    By Wikster7 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 01-19-2016, 11:17 AM
  3. sorting text from one cell into 3 other cells based on text criteria
    By steik in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-14-2014, 06:35 PM
  4. need help sorting by partial text in a cell - I think! :)
    By SmithAngels in forum Excel General
    Replies: 16
    Last Post: 10-11-2013, 09:58 AM
  5. [SOLVED] Sorting cell that contains TEXT only
    By gulagulaimoet in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 12-15-2012, 07:02 AM
  6. Excel 2007 : Sorting text within a cell
    By swasinger in forum Excel General
    Replies: 2
    Last Post: 07-02-2010, 01:20 PM
  7. Sorting text within a cell
    By tpink in forum Excel General
    Replies: 7
    Last Post: 10-24-2006, 01:46 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1