+ Reply to Thread
Results 1 to 12 of 12

Extract 9 largest categories - similar to pivot table but need formula

  1. #1
    Registered User
    Join Date
    08-20-2014
    Location
    San Mateo, CA
    MS-Off Ver
    2010
    Posts
    86

    Extract 9 largest categories - similar to pivot table but need formula

    Hello,

    What I'm looking to do is sum the total of the 9 largest categories and then have the 10th category as "other" which will sum the total of all others. I'm able to extract the top 9 and other - but if the category has two rows, I need to figure out how to sum it, then extract it. Thank you so much!!

    Sum categories extract to overview tab.xlsx

  2. #2
    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,277

    Re: Extract 9 largest categories - similar to pivot table but need formula

    Used helper in C4 down to rank duplicates

    =B4+ROWS($1:1)*10^-3

    In G4 to G12

    =LARGE($B$4:$B$14,ROWS($1:1))

    in G13

    =SUMIF($C$4:$C$14,"<" &LARGE($C$4:$C$14,9),$B$4:$B$14)

  3. #3
    Registered User
    Join Date
    08-20-2014
    Location
    San Mateo, CA
    MS-Off Ver
    2010
    Posts
    86

    Re: Extract 9 largest categories - similar to pivot table but need formula

    Thanks, John!

    The only issue with this is the data is always going to change and I basically need the data extracted over from the data tab. Unless I placed the helper in C4 in the wrong place... I placed it next to the pivot table which already had those numbers there. How do you get the categories to sum all of the rows and then extract the top 9 without using a pivot table? Thanks so much!!

  4. #4
    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,277

    Re: Extract 9 largest categories - similar to pivot table but need formula

    See attached:

    In E4 and copy down to get unique list of "fruits"

    =IFERROR(INDEX(Table1[type],MATCH(0,INDEX(COUNTIF($E$3:E3,Table1[type]),0,0),0)),"")

    in F4 total values

    =SUMIF(Table1[type],Overview!E4,Table1[size])

    in G4 Ranking

    =RANK(F4,$F$4:$F$14)+ROWS($1:1)*10^-3

    In I4/J4 sorted list

    =INDEX($E$4:$E$14,MATCH(SMALL($G$4:$G$14,ROWS($1:1)),$G$4:$G$14,0))

    =INDEX($F$4:$F$14,MATCH(SMALL($G$4:$G$14,ROWS($1:1)),$G$4:$G$14,0))

    in L4 down for 9 rows

    =INDEX($I$4:$I$14,MATCH(LARGE($J$4:$J$14,ROWS($1:1)),$J$4:$J$14,0))

    In M4

    =LARGE($J$4:$J$14,ROWS($1:1))

    in M13

    =SUMIF($G$4:$G$14,">" &SMALL($G$4:$G$14,9),$J$4:$J$14)

    Note change to SMALL!
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-20-2014
    Location
    San Mateo, CA
    MS-Off Ver
    2010
    Posts
    86

    Re: Extract 9 largest categories - similar to pivot table but need formula

    This is perfect! Thank you so much!

    One other question Could you do the same thing but instead only pull the data that has the letter "a" in column B on the data tab?

  6. #6
    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,277

    Re: Extract 9 largest categories - similar to pivot table but need formula

    The simplest way is to change the SUMIF in column F to SUMIFS

    =SUMIFS(Table1[size],Table1[type],Overview!E4,Table1[letter],"a")

    You will get zeros for many of the values.

  7. #7
    Registered User
    Join Date
    08-20-2014
    Location
    San Mateo, CA
    MS-Off Ver
    2010
    Posts
    86

    Re: Extract 9 largest categories - similar to pivot table but need formula

    Totally makes sense! Is there a way to add it to the type category? Thank you so much!

  8. #8
    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,277

    Re: Extract 9 largest categories - similar to pivot table but need formula

    In what way: do you want "Strawberry-a" or similar?

  9. #9
    Registered User
    Join Date
    08-20-2014
    Location
    San Mateo, CA
    MS-Off Ver
    2010
    Posts
    86

    Re: Extract 9 largest categories - similar to pivot table but need formula

    I only want to find the top values (in this case it's 3 or so) that have the letter 'a' in the letter column. So it would only sum the total of strawberry, apple, and cranberry. You're awesome - thanks so much!

  10. #10
    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,277

    Re: Extract 9 largest categories - similar to pivot table but need formula

    That's what the SUMIFS does: simply sums any "a" products.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    08-20-2014
    Location
    San Mateo, CA
    MS-Off Ver
    2010
    Posts
    86

    Re: Extract 9 largest categories - similar to pivot table but need formula

    Perfect - thanks, Tom!

  12. #12
    Registered User
    Join Date
    08-20-2014
    Location
    San Mateo, CA
    MS-Off Ver
    2010
    Posts
    86

    Re: Extract 9 largest categories - similar to pivot table but need formula

    Okay - last question!

    When the data is extracted over to the "sorted by rank" table - how would you not include the category "carrot" - it just skips it?

+ 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. Replies: 7
    Last Post: 06-20-2016, 08:37 AM
  2. Summarize many categories on 1 pivot table
    By Ron Purpura in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 04-01-2016, 03:21 AM
  3. [SOLVED] Pivot Table/Chart to filter categories
    By Maxthelion in forum Excel Charting & Pivots
    Replies: 14
    Last Post: 05-20-2014, 10:26 AM
  4. [NOT POSSIBLE] Pivot table with calculated item to show only categories > 0
    By bagullo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-02-2011, 03:20 AM
  5. extract lines from a table with similar field in column
    By jmwismer in forum Excel General
    Replies: 2
    Last Post: 02-26-2011, 01:52 PM
  6. nth largest value in pivot table
    By caballeroblanco in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-24-2009, 08:58 AM
  7. Pivot table - show absent categories
    By andrefrancis1 in forum Excel General
    Replies: 2
    Last Post: 11-07-2007, 06:00 AM

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