+ Reply to Thread
Results 1 to 16 of 16

Index matching with Large() calculation

  1. #1
    Registered User
    Join Date
    07-19-2013
    Location
    Southampton, England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Angry Index matching with Large() calculation

    Hi all,

    First post here so please be gentle. Self taught excel guru, finding limits and googling my way past them

    However, I haven't been able to find a solution to this one (or perhaps I am over complicating it) I know what I need to do but not quite sure how:

    So I have a sheet called `Data`, which has multiple criteria in the following layout (its bigger than this - about 13k lines - but that gives you the idea):

    A_____________B_________C
    product code___category___sales
    ABC123456_____Fruit______34
    ABC432342_____Fruit______3
    MEA123456_____Meat_____22
    MEA432342_____Meat_____19

    Currently, I use the following formula on another sheet, in column B, to list the top 20 selling products from the data sheet:

    A B
    1 =INDEX(Data!$1:$1048576,MATCH(LARGE(Data!$C:$C,$A1),Data!$C:$C,0),1)
    2 =INDEX(Data!$1:$1048576,MATCH(LARGE(Data!$C:$C,$A2),Data!$C:$C,0),1)
    3 =INDEX(Data!$1:$1048576,MATCH(LARGE(Data!$C:$C,$A3),Data!$C:$C,0),1)
    4 =INDEX(Data!$1:$1048576,MATCH(LARGE(Data!$C:$C,$A4),Data!$C:$C,0),1)
    etc

    This works perfectly in giving me the overall top 20 - however - I want to now be able to produce a top 20 by product category (column B) on the data tab...

    In my head the formula is the same as the above, but with another criteria applied to only search in the specified product category.

    Any ideas?

    Many thanks!
    Last edited by dr3amz; 07-19-2013 at 04:46 AM.

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Index matching with Large() calculation

    Hi and welcome to the forum.

    Be sure that best way to describe your problem is to upload a sample workbook.

    Be sure that all sensitive data removed, showing what data you are working with, a few examples of what your expected outcome is, and how you arrived at that.

    To attach a small sample workbook.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Registered User
    Join Date
    07-19-2013
    Location
    Southampton, England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Index matching with Large() calculation

    dr3amzexample.xlsx

    Here you go - I want to be able to create separate sales `leagues` based on specific categories (and I don't want to use pivots

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Index matching with Large() calculation

    1 way could be this.

    We create a unigue list of products.

    =LOOKUP(REPT("Z";5);CHOOSE({1\2};"";INDEX(Data!$B$2:$B$20;MATCH(TRUE;INDEX(ISNA(MATCH(Data!$B$2:$B$20;I$1:I1;0));0);0);1)))

    We get the quantities

    =SUMIF(Data!$B$2:$B$20;I2;Data!$C$2:$C$20)

    We rank these.

    =IFERROR(RANK(J2;$J$2:$J$10);"")

    W e stop here or we continue using.

    =IFERROR(INDEX($I$2:$I$10;MATCH(LARGE($J$2:$J$10;ROW(A1));$J$2:$J$10;0));"")

    And...

    =IF(E2<>"";SUMIF($I$2:$I$10;E2;$J$2:$J$10);"")
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-19-2013
    Location
    Southampton, England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Index matching with Large() calculation

    erm thats interesting but I don't think what I was after...

    I want to be able to list the top products from each specific category

    so... if i wanted a list of top selling fruit, it would return:

    1 ABC1234 24
    2 PEA1234 13

    Meat would return:

    1 FIS1231 56
    2 MEA4561 32
    3 LAM5843 11

    ?

  6. #6
    Forum Contributor
    Join Date
    06-26-2013
    Location
    LAX
    MS-Off Ver
    Excel 2007,Excel 2010
    Posts
    363

    Re: Index matching with Large() calculation

    Hello,

    See if the attached file helps.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    07-19-2013
    Location
    Southampton, England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Index matching with Large() calculation

    close - see what you did - but the reason I avoided that is if you have duplicate sales figures you end up with duplicate results

    that's why large/rank need to factor in this somehow?

  8. #8
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Index matching with Large() calculation

    What about these?

    =IFERROR(INDEX(Data!$A$2:$A$6;MATCH(LARGE((Data!$C$2:$C$6+ROW(Data!$C$2:$C$6)/1000000)*(Data!$B$2:$B$6=$F$1);ROW(A1));(Data!$C$2:$C$6+ROW(Data!$C$2:$C$6)/1000000)*(Data!$B$2:$B$6=$F$1);0));"")

    =IFERROR(INDEX(Data!$B$2:$B$20;SMALL(IF(Data!$A$2:$A$20=$F2;ROW(Data!$B$2:$B$20)-1);ROW(Data!$B$1)));"")

    ARRAY
    formulas.

    =IF(E2="Meat";SUMIF(Data!$A$2:$A$20;F2;Data!$C$2:$C$20);"")
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    07-19-2013
    Location
    Southampton, England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Index matching with Large() calculation

    looks almost right - but changing the category (as there would be around 50) doesn't work though?

  10. #10
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Index matching with Large() calculation

    Adding a validation list in F1 and using in all formulas F1 as reference cell, is better?
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    07-19-2013
    Location
    Southampton, England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Index matching with Large() calculation

    resolved it - a lot simpler too - i'll add a rank within the data sheet as follows: =SUMPRODUCT((B$2:B$100=B2)*(C$2:C$100>C2))+1

  12. #12
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Index matching with Large() calculation

    Well done!

    Simply and without me want to in touch on .. I have a simple question.

    Do not you ever thank anyone for any reason, or only in this case?

  13. #13
    Registered User
    Join Date
    07-19-2013
    Location
    Southampton, England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Index matching with Large() calculation

    Sorry, at work so was really pushed to get something finished and of course, thanks to everyone for their input it is greatly appreciated (I'll be here helping out too as am a self-taught excel guru (still finding my limits though!).

    Sumproduct kinda worked but on 13k+ lines is far too slow and just cripples excel - trying to do it all from one formula (i may be trying the impossible) if this is where I need to start learning VBA - then that gives me a good reason to

  14. #14
    Forum Contributor
    Join Date
    06-26-2013
    Location
    LAX
    MS-Off Ver
    Excel 2007,Excel 2010
    Posts
    363

    Re: Index matching with Large() calculation

    Got it and Learnt 1 new technique

  15. #15
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Index matching with Large() calculation

    Thank you for the feed back and your explanations.

    To say the true i have not understand what are you try to do using SUMPRODUCT.

    Perhaps using COUNTIFS?...

  16. #16
    Registered User
    Join Date
    07-19-2013
    Location
    Southampton, England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Index matching with Large() calculation

    to be honest, i think i've pushed excel formulas as far as i can (in terms of what i want/need to do) and perhaps need to move on to VBA/coding - anyone recommend a good place to start? (i've got a solid (lol) background in advanced basic programming so think i can pick it up pretty quickly)

+ 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: 4
    Last Post: 12-27-2012, 06:18 PM
  2. Detect matching values in very large lists
    By Jbentley in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-09-2009, 04:08 AM
  3. Index, Match, and Large
    By edwardpestian in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-03-2006, 06:10 PM
  4. [SOLVED] Non-calculation in large workbook
    By Edward in forum Excel General
    Replies: 0
    Last Post: 06-05-2006, 02:15 PM
  5. LARGE and INDEX functions
    By bob in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-03-2006, 02:15 AM

Tags for this Thread

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