+ Reply to Thread
Results 1 to 12 of 12

Using Excel Formulas to Pull the Top 10, Including Ties or Duplicates, Across Two Criteria

  1. #1
    Registered User
    Join Date
    01-14-2015
    Location
    Portland, Oregon
    MS-Off Ver
    Excel for MS 365
    Posts
    40

    Using Excel Formulas to Pull the Top 10, Including Ties or Duplicates, Across Two Criteria

    Hello,

    I have used a video by Excel Magic Trick to develop a spreadsheet that shows the top-10, including ties and duplicates, for a data set. The problem is that it shows the top10 by sales, but it doesn't allow me to create separate tables based on two criteria (Category and Sales). So, if I have a data set like that listed below (imagine 20 territories and multiple categories and random sales figures) I want to know within just Category = TV what the top 10 sales results were.

    Territory Category Sales
    1 TV $200
    1 Computer $100
    1 Software $300
    2 TV $150
    2 Computer $325
    2 Software $270


    This video from Excel Magic Trick gets me close (ranking top by sales) but doesn't get me to the point where I can only include those with Category=TV.

    www[dot]youtube[dot]com/watch?v=rKDI-kdBsjY

    Thanks,
    IGoCougsI

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Using Excel Formulas to Pull the Top 10, Including Ties or Duplicates, Across Two Crit

    hey there. assuming your data in A1:C7, and desired result for top 10 in E1:F10 (category and price), try this array formula in F2:
    =IFERROR(LARGE(IF($B$2:$B$7="TV",$C$2:$C$7),ROWS($F$2:F2)),"")

    and in E2:
    =IFERROR(INDEX($B$2:$B$7,SMALL(IF($B$2:$B$7="TV",IF($C$2:$C$7=F2,ROW($C$2:$C$7))),COUNTIF($F$2:F2,F2))-ROW($B$2)+1),"")

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

    OR using AGGREGATE (CTRL + SHIFT + ENTER not needed):
    =IFERROR(INDEX($B$2:$B$7,AGGREGATE(15,6,ROW($C$2:$C$7)/(($B$2:$B$7="TV")*($C$2:$C$7=F2)),COUNTIF($F$2:F2,F2))-ROW($B$2)+1),"")
    =IFERROR(AGGREGATE(14,6,$C$2:$C$7/($B$2:$B$7="TV"),ROWS($F$2:F2)),"")
    Last edited by benishiryo; 10-31-2018 at 08:45 PM.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    01-14-2015
    Location
    Portland, Oregon
    MS-Off Ver
    Excel for MS 365
    Posts
    40

    Re: Using Excel Formulas to Pull the Top 10, Including Ties or Duplicates, Across Two Crit

    Hi b50enishiryo,

    Thank you, this has largely helped me out. I have a follow-up question. While your formulas enabled me to build a top10 table, I am struggling now with how to take those ten sales records for TVs (the two criteria for my top-10 list) and incorporate in the table the unique ID# for each of those records in the dataset. There needs to be some logic that ensures that two identical sales results (i.e. TV sales of $450) which are two separate entries in the data set, reflect the two different unique ID#s in the data set. With this, I could then do simple Vlookups on the unique ID to fill in any additional reporting data associated with the top-10 records.

    See attached file which I am using as my sandbox for this.

    Appreciate in advance any assistance!

    IGoCougsI
    Attached Files Attached Files

  4. #4
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Using Excel Formulas to Pull the Top 10, Including Ties or Duplicates, Across Two Crit

    you should have came up with this file first. makes it all easier. use this array formula in cell O3:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    since it's a unique ID, your Q3 and R3 is much simpler:
    =IFERROR(VLOOKUP(O3,A:D,3,0),"")
    =IFERROR(VLOOKUP(O3,A:D,4,0),"")

  5. #5
    Registered User
    Join Date
    01-14-2015
    Location
    Portland, Oregon
    MS-Off Ver
    Excel for MS 365
    Posts
    40

    Re: Using Excel Formulas to Pull the Top 10, Including Ties or Duplicates, Across Two Crit

    I am struggling again on this as I revisit it. Help is greatly appreciated. See attached file.

    1) How to pull the ID# from Column A of the Dataset into this table?

    2) How to remove from this table those rows from the DATASET that are marked "Y" within the Non-Exempt column?
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Using Excel Formulas to Pull the Top 10, Including Ties or Duplicates, Across Two Crit

    ARRAY formulas for columns P, R and S.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  7. #7
    Registered User
    Join Date
    01-14-2015
    Location
    Portland, Oregon
    MS-Off Ver
    Excel for MS 365
    Posts
    40

    Re: Using Excel Formulas to Pull the Top 10, Including Ties or Duplicates, Across Two Crit

    Hi, This has been helpful. I'm trying to apply what you have taught me to another scenario with a utility to limit by year. Can you please review the attached and see the comments in red text?
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    01-14-2015
    Location
    Portland, Oregon
    MS-Off Ver
    Excel for MS 365
    Posts
    40

    Re: Using Excel Formulas to Pull the Top 10, Including Ties or Duplicates, Across Two Crit

    Bumping for a response. Thx.

  9. #9
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Using Excel Formulas to Pull the Top 10, Including Ties or Duplicates, Across Two Crit

    Upload file showing the required result manually (no formulas) for the selections made in Beq sheet.

  10. #10
    Registered User
    Join Date
    01-14-2015
    Location
    Portland, Oregon
    MS-Off Ver
    Excel for MS 365
    Posts
    40

    Re: Using Excel Formulas to Pull the Top 10, Including Ties or Duplicates, Across Two Crit

    I've uploaded an Excel file that has the source data on a first tab and then there is a Dynamic Report tab which has the report I am trying to build with formulas included. There are errors in it as it is not filtering out duplicate values and isolating on the correct purchase year as desired. I then have two examples of what the dynamic report is producing as compared to the desired results. These are done using a 2-year selection and a 10-year selection. I hope this makes it clear. Within the static reports you will see where I have identified the issues using red and comment notes.
    Attached Files Attached Files
    Last edited by IGoCougsI; 05-28-2019 at 07:04 PM.

  11. #11
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Using Excel Formulas to Pull the Top 10, Including Ties or Duplicates, Across Two Crit

    Please try at Dynamic report H11:H

    =AGGREGATE(15,6,ROW(Data!$G$5:$G$5000)/(Data!$G$5:$G$5000=I11)/(YEAR(Data!$E$5:$E$5092)>=YEAR($E$2)-IF(ISTEXT($E$3),999,$E$3)),COUNTIF(I$11:I11,I11))-ROW(Data!$A$4)

  12. #12
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Using Excel Formulas to Pull the Top 10, Including Ties or Duplicates, Across Two Crit

    In B2 then drag across upto column E. Note slight changes are done in headings of Dynamic report Sheet.
    Please Login or Register  to view this content.
    In F2 then copy down
    Please Login or Register  to view this content.
    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] How to break ties when using Large, Small formulas
    By iowagrad2003 in forum Excel General
    Replies: 7
    Last Post: 07-01-2015, 07:57 AM
  2. [SOLVED] Search for criteria and pull all corresponding values with duplicates
    By bradbracey in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-28-2012, 11:37 AM
  3. Including "Ties" in MIN INDEX Result
    By bobbby1949 in forum Excel - New Users/Basics
    Replies: 9
    Last Post: 04-13-2011, 10:33 AM
  4. Eliminating Ties in MAX/MATCH formulas
    By Johnmus in forum Excel - New Users/Basics
    Replies: 6
    Last Post: 02-14-2011, 09:02 AM
  5. Replies: 5
    Last Post: 01-06-2011, 03:11 PM
  6. Including ties to a MIN code
    By bobbby1949 in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 10-01-2010, 03:07 PM
  7. Listing Specific Values Based on Criteria (Including Duplicates)
    By Jace in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-22-2008, 02:57 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