+ Reply to Thread
Results 1 to 7 of 7

Advanced Sorting

  1. #1
    Registered User
    Join Date
    08-09-2010
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2003
    Posts
    9

    Advanced Sorting

    Hi,

    Here's a question that I'm stumped on.

    I have a list of products in Column A (approximately 50), and a list of Companies (approx 400) in the rest of the colums, with sales volume of each product populating the data.



    Company 1 Company 2 Company 3
    Product 1 125 250 3
    Product 2 250 125 56
    Product 3 75 3 450


    Each company has a different Top 10 products. Is there a way to sort the top 10 of each company? I'm currently doing it with a pivot table, but because each company is different I have to do it one at a time, and copy it over to another worksheet. I have to do this for 400+ companies - there's got to be a different way!

  2. #2
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Advanced Sorting

    I think so, but please upload a (trimmed and anonymised) example so I can try out the idea before sending you down a blind alley...
    CC


    If you feel really indebted please consider a donation to charity. My preferred charity is ActionAid but there are plenty of worthy alternatives.

  3. #3
    Registered User
    Join Date
    08-09-2010
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Advanced Sorting

    Attached is an example.
    As you can see from the tab "Format When Sorted" I don't need the numbers - just the products sorted by compnay an order.

    Seems like there should be an easy way

    Mike
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Advanced Sorting

    Rank the products against company in the raw data, I used:
    =rank(B2,B$2:B$41)
    in R2, copied down and across to replicate the whole table
    Then, on your results page, use the rankings to return the position of the product names:
    =INDEX(Raw!$A$2:$A$41,MATCH(COLUMNS($A:A),INDEX(Raw!$R$2:$AG$41,0,ROWS($1:1)),0))
    in B3
    (a lot more complex-looking than it really is as it also transposes (rows-columns) the results from the original layout)

    The only problem is that dupes don't carry through properly...

    I'm still thinking on that one - I've had a thought, simple way is:
    Raw!R2=RANK(B2,B$2:B$41)+COUNTIF(R$1:R1,RANK(B2,B$2:B$41))

    There's probably a more glamorous way, but I'm too tired to think of it
    Last edited by Cheeky Charlie; 08-09-2010 at 06:25 PM. Reason: I had a thought

  5. #5
    Registered User
    Join Date
    08-09-2010
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Advanced Sorting

    Thank-you so much for your help so far, I am very grateful.
    I've actually changed things around a little bit, and I was able to arrange the list a little different - I've got it ranked properly now. The problem I think I'm having is with the index / match arguments.

    So to be clear, now that the sheet "Raw" is ranked; I need to return the column heading corresponding to the top 10 ranked products.

    I've physically put in the value in Row2 on "Summary" so you can see what I mean.

    I couldn't figure out the match/index stuff so your help is greatly appreciated.

    Cheers, Mike
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Advanced Sorting

    Yeah, the index/match was really complex because I had to transpose the results - should be a lot easier now.

    Are the companies (F0A, R0B etc.) always going to match? Can make the formula simpler if so.

    Following the previous logic:
    Raw DY2
    =RANK(B2,$B2:$DW2)+COUNTIF($A2:A2,B2)
    Copied across and down to replicate entire table (goes to IT424)
    Summary B2
    =INDEX(RAW!$B$1:$DW$1,MATCH(COLUMNS($A:A),RAW!$DY2:$IT2,0))
    copied across and down

    The formula on the summary page can be developed to accomodate the companies not being in the same order, but if they always will be this is unnecessary
    Last edited by Cheeky Charlie; 08-10-2010 at 11:52 AM. Reason: Add solution

  7. #7
    Registered User
    Join Date
    08-09-2010
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Advanced Sorting

    Yes, the companies should always match.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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