+ Reply to Thread
Results 1 to 5 of 5

Ascending sorting within cell

  1. #1
    Forum Contributor
    Join Date
    12-23-2013
    Location
    Hungary
    MS-Off Ver
    Excel 2013
    Posts
    331

    Ascending sorting within cell

    Hello,

    I would like to ask that how is it possible to sort (ascending) the values within cell with vba, the values separeted by comma ",".

    For instance: A1 = 4, 5, 1, 3, 2

    Thanks in advance the reply!

  2. #2
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Ascending sorting within cell

    Check out the attachment. I coded up a worksheet function you could use to do this.

    =sortWithinCell(Cell_With_List,",",1) -> that will produce an ascending list (like 1,2,3,4,5)

    =sortWithinCell(Cell_With_List,",",ANY OTHER INTEGER) -> that will produce a descending list (like 5,4,3,2,1)


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by GeneralDisarray; 07-03-2014 at 09:39 AM. Reason: Removed annoying trailing 0 value
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  3. #3
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Ascending sorting within cell

    hi Villalobos, option, please check attachment, press Run button or run code "test
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    12-23-2013
    Location
    Hungary
    MS-Off Ver
    Excel 2013
    Posts
    331

    Re: Ascending sorting within cell

    Hello GeneralDisarray and watersev,

    Your solutions are perfect, I would like to say thank you for the help!

  5. #5
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Ascending sorting within cell

    Thank you, glad to help.

+ 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. [SOLVED] Sorting Columns in Ascending Order
    By COLIN_303 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-17-2013, 07:51 AM
  2. x axis ascending order without sorting
    By vbidiot in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-30-2008, 09:31 AM
  3. ascending sorting
    By fofomama in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-14-2006, 10:45 AM
  4. Sorting Data in ascending order
    By sharon2006 in forum Excel General
    Replies: 1
    Last Post: 03-13-2006, 09:10 PM
  5. sorting number in ascending order
    By Janice Lee via OfficeKB.com in forum Excel General
    Replies: 2
    Last Post: 04-08-2005, 06:06 PM

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