+ Reply to Thread
Results 1 to 7 of 7

Is there any way to Sort and Separate into columns?

  1. #1
    Registered User
    Join Date
    01-12-2020
    Location
    Philadelphia, PA
    MS-Off Ver
    2016
    Posts
    97

    Is there any way to Sort and Separate into columns?

    I hope I can explain well what I want to do, so I'll try to make it simple:

    Is there way way I can have Excel look at a cell (let's say "B2"), and based on the value of that cell, copy a range of cells (let's say A2:D2) into maybe F2:I2, J2:M2, etc?

    For instance, if I had a list...

    ITEM TYPE PRICE
    Apple Fruit .49
    Pear Fruit .59
    Corn Veg .69
    Eggs Dairy 2.50
    Tomato Veg .79

    ...and then I could separate the categories put all three (A:C) Fruit cells in E:G, Veggie cells in H:J, Dairy in K:M, etc.

    Thanks!

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Is there any way to Sort and Separate into columns?

    I think you're looking for a pivot table solution (See attachment). If this is not what you are looking for, try uploading an example workbook as described in the yellow banner at the top of the page. Let us know if you have any questions.
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,986

    Re: Is there any way to Sort and Separate into columns?

    If not, please read the yellow banner (top of page) and provide a sample sheet for us to play with.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Registered User
    Join Date
    01-12-2020
    Location
    Philadelphia, PA
    MS-Off Ver
    2016
    Posts
    97

    Re: Is there any way to Sort and Separate into columns?

    I was thinking more along the lines of this
    Attached Files Attached Files

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,986

    Re: Is there any way to Sort and Separate into columns?

    One way, in E2, copied across and down:

    =IFERROR(INDEX($A:$C,AGGREGATE(15,6,ROW($B$3:$B$100)/($B$3:$B$100=INDEX($E$1:$M$1,1+3*INT((COLUMNS($E2:E2)-1)/3))),ROWS(E$2:E2)),1+MOD((COLUMNS($E2:E2)-1),3)),"")
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-12-2020
    Location
    Philadelphia, PA
    MS-Off Ver
    2016
    Posts
    97

    Re: Is there any way to Sort and Separate into columns?

    That looks great! I don't understand it at all, but after I search for INDEX, AGGREGATE, and COLUMNS and educate myself, hopefully I will grasp it better! Thanks!

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,986

    Re: Is there any way to Sort and Separate into columns?

    At its heart is a simple enough formula:

    =INDEX($A:$A,AGGREGATE(15,6,ROW($B$3:$B$100)/($B$3:$B$100=$E$1),ROWS(E$2:E2)))

    Red return these row numbers
    Orange where these conditions are met
    Green in ascending order
    Blue starting from the lowest (a counter... 1, 2, 3, etc)
    Black finally returning the corresponding values from column A.

    The rest just expands it by adding on two additional counters to select the correct columns and restart numbering as required. I have reposted the file (with the solutiuon in place, this time, but covering ONLY the exact number of rows required.

    Now use formulas/evaluate formula to step through the formula to see exactly what it's doing.




    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

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

+ 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] Formula to separate joined numbers in one column into two columns or two separate cells
    By Doofus1 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-28-2019, 05:23 PM
  2. Sort by month into two separate columns
    By Juddk in forum Excel General
    Replies: 18
    Last Post: 09-20-2017, 02:21 PM
  3. Macro to separate long string of characters and several spaces into separate columns
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-31-2017, 07:37 PM
  4. VBA to separate and sort multiple columns
    By paulblower in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-17-2014, 08:53 AM
  5. [SOLVED] Match Multiple Columns from Separate Sheet to get separate column.
    By gvitoro in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-19-2014, 03:38 PM
  6. [SOLVED] Macro to copy 3 adjacent columns at a time to a separate worksheet & sort by Company name
    By anya1 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-20-2013, 06:50 AM
  7. Sort Data from one column to Separate Columns
    By Griff0 in forum Excel General
    Replies: 11
    Last Post: 06-06-2010, 08:43 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