+ Reply to Thread
Results 1 to 5 of 5

Stuck creating formula that sorts highest to lowest then sum quantity

  1. #1
    Registered User
    Join Date
    07-18-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    84

    Stuck creating formula that sorts highest to lowest then sum quantity

    Hello

    I have attached a replica file which i will use to duplicate solution (if any) to live file - please can you take a look?

    In the 'Main' sheet, cell B3, i am trying to return the shop with the highest quantity of 'complaints'; by adding up values in column M in the 'MON' sheet. The 'shop' range in the 'MON' sheet is in column E.

    I would like to also return the counted quantity of that query, in D3, of the 'Main' sheet.

    So in this example i am expecting shop '234' in B3 (main sheet) and '48' in D3. So '234' is the shop with most complaints, and the quantity of complaints was 48.

    I'll copy the formula into the other cells in the 'Main sheet'. E.g. i'll do the same for Column E, H, & K (same with the counted quantity, column D, G, J & M)

    I'll also copy these down to the other highlighted boxes.

    I understand this might be a two part formula? Sort then sum? Not sure!

    Hope this makes sense

    Thanks
    Z
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Stuck creating formula that sorts highest to lowest then sum quantity

    I'm sure there will be a more effective way to do this via Array Formula's however they lose me every time!

    I would add in 6 columns (MON to SAT) to the Names & IDs table to SUMIF for each shop, then display the MAX value from the respective column in column D, then it's a case of INDEX/MATCH to lookup the shop number. I've attached my test file for reference
    Attached Files Attached Files
    If someone has helped you then please add to their Reputation

  3. #3
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Stuck creating formula that sorts highest to lowest then sum quantity

    Try this formula, Array confirmed, in D3

    =MAX(SUMIF(MON!$E$2:$E$20,MON!$E$2:$E$20,MON!$M$2:$M$20))

    Then this one, Array confirmed, in B3

    =INDEX(MON!$E$2:$E$20,MATCH(D3,SUMIF(MON!$E$2:$E$20,MON!$E$2:$E$20,MON!$M$2:$M$20),0))

    ...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.

    To make the formula work when you fill down would require the use of INDIRECT to use the weekday in column A of Main as the sheet reference. I would be reluctant to provide a formula that does this as there could be as the number of rows could be different each day.

    This could be achieved with some dynamic named ranges, but given your data layout, they would need to be set up carefully!

  4. #4
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Stuck creating formula that sorts highest to lowest then sum quantity

    I told you that someone would come up with a much cleverer answer.

    In seriousness though, when you use Array formulas you need to be sure that
    a) you understand how they work so if there's a change in your sheet/ calculations etc you can amend the formula accordingly and it doesn't just die

    b) any other users are aware if you pass the sheet on to someone else to own.

  5. #5
    Registered User
    Join Date
    07-18-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    84

    Re: Stuck creating formula that sorts highest to lowest then sum quantity

    Thanks

    This one works!

    I was able to copy right and down; just had to be careful replacing correct location

+ 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: 11
    Last Post: 08-17-2018, 02:53 AM
  2. Macro for creating a pivot table sorted with highest to Lowest chargeable Weight
    By ADITHYA1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-04-2018, 02:24 AM
  3. Replies: 3
    Last Post: 03-22-2016, 04:42 PM
  4. [SOLVED] $ Total a Quantity from Lowest to Highest Price
    By uberathlete in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-17-2015, 08:57 PM
  5. [SOLVED] In need of a formula to rank highest to lowest
    By ellie2014 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-30-2014, 12:48 AM
  6. [SOLVED] Line plot which automatically sorts values from lowest to highest
    By excelactuary in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 04-19-2013, 05:27 AM
  7. [SOLVED] Formula for highest/lowest cost
    By S S in forum Excel General
    Replies: 2
    Last Post: 04-29-2006, 11:25 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