+ Reply to Thread
Results 1 to 26 of 26

question related to Large Function

  1. #1
    Registered User
    Join Date
    06-21-2014
    Location
    Sydney
    MS-Off Ver
    2011
    Posts
    92

    question related to Large Function

    All,

    I would like to use the count and sum(large functions

    I have a list of values that add up to 100%, not all entries have a % value associated.

    I need to:
    a) Ensure the formula chooses the top 80% of data. Possibly using the large function
    =SUM(LARGE(G3:G130,ROW(INDIRECT("1:80"))))

    b) I need to count how many entries it has taken to form the top 80%

    Does anyone know how I could do this?

    Thanks so much

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: question related to Large Function

    If you post a sample workbook it will be much easier to help you.
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  3. #3
    Valued Forum Contributor TheCman81's Avatar
    Join Date
    11-06-2012
    Location
    Edinburgh, UK
    MS-Off Ver
    Excel 2003, 2007, 2010, 2013
    Posts
    346

    Re: question related to Large Function

    Hey dude. Does the attached help you? If not canyou clarify?

    Count top 80.xlsx
    Excel Guru in the making

    <----------If the question has been answered to your satisfication please click the Add Repuation star to the left

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: question related to Large Function

    cant see how counting top 80 would work if the cells add up to 100% then you could have 100 cells with 0.1 in or say 4 cells with 0.25 in
    what do you mean by 100%
    do you mean you have a range of cells that = say 160 so that is 100% of 160?
    to get same results as above a simpler non array
    =COUNTIF(A2:A20,">="&PERCENTILE(A2:A20,0.2))
    =SUMIF(A2:A20,">"&PERCENTILE(A2:A20,0.2))
    Last edited by martindwilson; 08-04-2014 at 04:37 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  5. #5
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: question related to Large Function

    With an Pivot Table.

    I used the file of TheCman81 for it.

    See the attached file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  6. #6
    Registered User
    Join Date
    06-21-2014
    Location
    Sydney
    MS-Off Ver
    2011
    Posts
    92

    Re: question related to Large Function

    Thanks all,

    I will read through the responses and I have also put a sample sheet together which is attached
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-21-2014
    Location
    Sydney
    MS-Off Ver
    2011
    Posts
    92

    Re: question related to Large Function

    To CMAN 81 thank-you I believe that is what I am after...could you help me build in a condition for the division as in my attached spreadsheet? The formula is complex and I am unsure of the syntax

    Thanks so much

  8. #8
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: question related to Large Function

    With an pivot table.

    See the attached file.

  9. #9
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: question related to Large Function

    for your example
    in g5 filled down to g7
    this array entered formula
    =MATCH(1,IF(SUBTOTAL(9,OFFSET(INDEX($C:$C,MATCH(F5,$A:$A,0)),0,0,ROW(INDIRECT("1:"&COUNTIF($A:$A,F5)))))>=80,1),0)
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor TheCman81's Avatar
    Join Date
    11-06-2012
    Location
    Edinburgh, UK
    MS-Off Ver
    Excel 2003, 2007, 2010, 2013
    Posts
    346

    Re: question related to Large Function

    Please see attached.

    Also forgot to mention these are array formulas and need to be entered with Ctrl Shift Enter

    Large Function v2.xlsx

  11. #11
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: question related to Large Function

    hm i think i am not reading this correctly

  12. #12
    Registered User
    Join Date
    06-21-2014
    Location
    Sydney
    MS-Off Ver
    2011
    Posts
    92

    Re: question related to Large Function

    Hi Guys,

    I think we are getting close, I have attached another sheet of how it was done previously but I am very very hopeful we can use the large function without having to use a helper column (the raw data is now structured wildly differently and there is no way to sort the data to make this possible) I think we are so close

    Thanks soooo much for all of your help
    Attached Files Attached Files

  13. #13
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: question related to Large Function

    so from this you want the largest x that ad up to >=80?
    12.185
    4.477
    3.07
    7.505
    4.604
    2.128
    11.145
    11.134
    3.017
    3.929
    5.629
    5.869
    0.54
    5.614
    18.763
    0.39
    which would be
    18.763
    12.185
    11.145
    11.134
    7.505
    5.869
    5.629
    5.614
    4.604

  14. #14
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: question related to Large Function

    Hi,

    So what's your expected result for the attached? 14?

    Regards
    Click * below if this answer helped

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

  15. #15
    Valued Forum Contributor TheCman81's Avatar
    Join Date
    11-06-2012
    Location
    Edinburgh, UK
    MS-Off Ver
    Excel 2003, 2007, 2010, 2013
    Posts
    346

    Re: question related to Large Function

    Can you give the expected results for Division 1 2 & 3? That way we can determain what formula to use

  16. #16
    Registered User
    Join Date
    06-21-2014
    Location
    Sydney
    MS-Off Ver
    2011
    Posts
    92

    Re: question related to Large Function

    Thanks so much guys, and apologies for the delay in my response as I'm in Sydney Australia and had to sleep!

    Will get onto this now and be sure of the solution we hope to achieve, thanks all for your patience and help. Will get back shortly......

  17. #17
    Registered User
    Join Date
    06-21-2014
    Location
    Sydney
    MS-Off Ver
    2011
    Posts
    92

    Re: question related to Large Function

    Thanks so much guys, the results are as follows

    Division 1 13
    Division 2 43
    Division 3 41

    I have also attached another version which shows the calculation for each 3 divisions

    Thanks all, it is soooo very much appreciated
    Attached Files Attached Files

  18. #18
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: question related to Large Function

    Hello Keelin,

    in your notes you say this:

    I was hoping the large function could get around having to sort the data and do a cumulative calculation, as in the end the count would be the same
    If you are saying that the count is the same however the data is sorted then I don't think I agree. If you were to sort in descending order of amounts for each division, for example, as Martin shows, then you only need the 9 largest items to get over 80%.

    The way you are doing it in the attached is dependent on the order, are you sure that's the way you want to do it?
    Audere est facere

  19. #19
    Registered User
    Join Date
    06-21-2014
    Location
    Sydney
    MS-Off Ver
    2011
    Posts
    92

    Re: question related to Large Function

    Hi Daddylonglegs, thanks so much for lending your expertise on this one. That is an excellent and thought provoking question.....and now I have a little shiver down my spine thinking our results were dependant on how the data was sorted (oh dear!)......

    ......thank-you soo much for this, leave it with me for a few minutes....

  20. #20
    Registered User
    Join Date
    06-21-2014
    Location
    Sydney
    MS-Off Ver
    2011
    Posts
    92

    Re: question related to Large Function

    Hi All

    Yes the results are indeed dependant on the data being sorted (So for the helper columns to work it has to be properly sorted - I had a major heart failure moment there thinking that the data that I used wasn't sorted properly.....but Pheeewwwwwww it is!) and stupid me forgot to sort the data in the sample spreadsheet I provided (thank-you very much Daddylonglegs for bringing that to my attention)

    With the way the data is now structured its not easy to sort it at all which is why I would love to be able to enlist a formula to do this.

    Have attached the spreadsheet with the data properly sorted, now the results show:

    Division 1 8
    Division 2 17
    Division 3 24

    which is (now) correct as per sorted data,

    (oh and its <= 80%)

    Thanks so much all,
    Attached Files Attached Files
    Last edited by Keelin; 08-04-2014 at 07:05 PM.

  21. #21
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: question related to Large Function

    Hi,

    Try this array formula** in G4:

    =MATCH(TRUE,MMULT(0+(ROW(INDIRECT("1:"&COUNTIF($A$4:$A$140,F4)))>=TRANSPOSE(ROW(INDIRECT("1:"&COUNTIF($A$4:$A$140,F4))))),LARGE(IF($A$4:$A$140=F4,$C$4:$C$140),ROW(INDIRECT("1:"&COUNTIF($A$4:$A$140,F4)))))>80,0)-1

    Copy down as required.

    Regards


    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).

  22. #22
    Registered User
    Join Date
    06-21-2014
    Location
    Sydney
    MS-Off Ver
    2011
    Posts
    92

    Re: question related to Large Function

    Thanks so much XOR LX, I will try that now....although I wont pretend to understand it!! Could you talk me through what its doing? (I have never come across MMULT before)

  23. #23
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: question related to Large Function

    This part:

    =MATCH(TRUE,MMULT(0+(ROW(INDIRECT("1:"&COUNTIF($A$4:$A$140,F4)))>=TRANSPOSE(ROW(INDIRECT("1:"&COUNTIF($A$4:$A$140,F4))))),LARGE(IF($A$4:$A$140=F4,$C$4:$C$140),ROW(INDIRECT("1:"&COUNTIF($A$4:$A$140,F4)))))>80,0)-1

    creates an array of integers from 1 up to the number of occurrences of the entry in F4 in the range A4:A140, e.g. for Division 1:

    {1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16}

    We then have:

    =MATCH(TRUE,MMULT(0+({1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16}>={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}),LARGE(IF($A$4:$A$140=F4,$C$4:$C$140),{1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16}))>80,0)-1

    This part:

    {1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16}>={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}

    will resolve to a 16-by-16 matrix consisting of Boolean TRUE/FALSE returns to the greater-than-or-equal-to comparison, i.e. (I'll just give the first three rows' worth and represent TRUE with T and FALSE with F):

    {T,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F;T,T,F,F,F,F,F,F,F,F,F,F,F,F,F,F;T,T,T,F,F,F,F,F,F,F,F,F,F,F,F,F;...}

    Adding zero to these Booleans converts them to their numerical equivalents (TRUE=1, FALSE=0):

    {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0;1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0;...}

    The other matrix within the MMULT is generated from the part in brown:

    =MATCH(TRUE,MMULT(0+({1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16}>={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}),LARGE(IF($A$4:$A$140=F4,$C$4:$C$140),{1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16}))>80,0)-1

    i.e.:

    LARGE(IF($A$4:$A$140=F4,$C$4:$C$140),{1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16})

    which generates an array, in descending order of size, of the values in column C corresponding to the required Division in column A:

    {18.763;12.185;11.145;11.134;7.505;5.869;5.629;5.614;4.604;4.477;3.929;3.07;3.017;2.128;0.54;0.39}

    If you know anything about matrix multiplication (which is precisely what MMULT is), then you'll know that the product of the above two matrices will produce precisely the cumulative totals you had when the sheet was ordered, i.e.:

    {18.763;30.948;42.093;53.227;60.732;66.601;72.23;77.844;82.448;...etc.}

    We now have:

    =MATCH(TRUE,{18.763;30.948;42.093;53.227;60.732;66.601;72.23;77.844;82.448;...etc.})>80,0)-1

    which I hope is relatively straightforward to understand.

    Regards

  24. #24
    Registered User
    Join Date
    06-21-2014
    Location
    Sydney
    MS-Off Ver
    2011
    Posts
    92

    Re: question related to Large Function

    UTTER GENIUS!!

    Won't lie its going to take me the best part of tomorrow morning to get my head around it!!

    Awesome work

  25. #25
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: question related to Large Function

    so after all that you gave us wrong info! you said 80% none of your answers are at 80% they are below

  26. #26
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: question related to Large Function

    Quote Originally Posted by Keelin View Post
    UTTER GENIUS!!

    Won't lie its going to take me the best part of tomorrow morning to get my head around it!!

    Awesome work
    You're welcome!

    Maybe get to your local library and look for a book on matrix algebra!

    Cheers

  27. #27
    Registered User
    Join Date
    06-21-2014
    Location
    Sydney
    MS-Off Ver
    2011
    Posts
    92

    Re: question related to Large Function

    Hi Martin,

    I am sorry about the 80% confusion, I suppose its because in my spreadsheet I have a result for 80% a result for 50% and a result for 95% so I guess I wanted it to be flexible to handle any sort of max figure that we put in the formula....this this was not a logical thought process at all as I fully understand NOW that its extremely important to ensure that the new formula is working properly. This is (I promise) a lesson learned.

    I fully agree with you, on this post there are many things I didn't think through thoroughly enough, something I will try to rectify fully and completely for any future posts as the last thing I want to do is waste peoples time. This forum is full of the smartest people in the world I reckon, and I will do my best to be much clearer with a properly defined answer in any future posts. I'm quite annoyed at myself that I didn't sort the data or be clear about the exact solution of above or below 80%.

    I will do better in the future Martin and thanks sooo very much for your help

+ 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. Question about Replace,If, Substitute, Min,Max Small,Large function
    By ayawoqu in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-15-2012, 01:26 AM
  2. Large function question
    By Weasel in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-30-2008, 01:30 PM
  3. I have a VB related question,...
    By javabeens in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-07-2005, 01:05 PM
  4. Function Related Question
    By Sandeep Arora in forum Excel General
    Replies: 1
    Last Post: 02-02-2005, 04:06 PM
  5. [SOLVED] =CELL("filename") function related question
    By wfcpyc in forum Excel General
    Replies: 2
    Last Post: 01-07-2005, 04:06 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