+ Reply to Thread
Results 1 to 7 of 7

Can Sumproduct and MAX/MIN be combined?

  1. #1
    all4excel
    Guest

    Can Sumproduct and MAX/MIN be combined?

    Can Sumproduct and MAX/MIN be combined?

    I need to calculate the MAX and MIN for values with a particular criteria stored in Multiple sheets as well as different rows..


    I have 5 sheets and the Sheets are going to keep on Increasing,
    I want to know the Highest from the Different Sheets, but this information is for a particular individual whose Records appear in Different Rows in all the Sheets...

    If it was in the same Row , then it would have been compartively easier by simply using this formula..

    [ =MAX(Sheet1:Sheet3!B3:B4) ]
    [ =LARGE(Sheet1:Sheet3!B3:B4,1) ]


    But I want to know the Max of one Individual whose data is not only spread across different Sheets but also in Different Rows...

    Can SUMPRODUCT & MAX/MIN be combined to get the above?

    Please help me on this?

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    You can use multiple ranges with either function:

    =max(rng1, rng2, rng3, ...)
    =large( (rng1, rng2, rng3, ...), 1)


    Note the extra set of parens in the second example.

  3. #3
    all4excel
    Guest

    Question Please find the attachment..

    Quote Originally Posted by shg
    You can use multiple ranges with either function:

    =max(rng1, rng2, rng3, ...)
    =large( (rng1, rng2, rng3, ...), 1)


    Note the extra set of parens in the second example.
    I want a formula which can work in such a way that whenver we add or delete tabs as long as we update the Name of the Tab in the column A as shown, it should pick the MAX and MIN from all the other sheets…

    Now the data is not only In Multiple Sheets but also in Different Rows and the Runs are also suffixed with an asterik (*) when the Batsman is Not Out..

    For Ex:- Andrew Silmoure has scored
    L& I - 14* where he is Not Out
    J P Morgan - 5
    H P - 6
    Dell - 100
    Hell - 100* - Not out

    Highest score would be 100* and lowest would be 5....
    Attached Files Attached Files

  4. #4
    all4excel
    Guest

    Any solution guyss..!

    BUmP.............

  5. #5
    Forum Contributor
    Join Date
    09-25-2004
    Posts
    269
    Hi all4excel



    Look at the attachment below. I had to add some helper columns in your workbook to get these formula to work. I also add some helper columns F & G just unhide them and you'll see the formulas. Also I used a formula so you don't have to list your worksheets. But you would have to check mark your Iteration in excel go to tools options and calculation. If not check mark it will give you a ref# error.


    P.S


    If you would like to know how the formulas work go to

    Tools > Formula Auding > Evaluate formula


    Hope this helps!
    Attached Files Attached Files

  6. #6
    all4excel
    Guest

    Smile One last thing though as there are some Anomalies

    HTML Code: 


    Hope this helps !

    This is an understatement..You are superb and so is your code and I'm really very happy..

    Dear Vane,

    Belated Happy Birthday,
    If you were born on 26Th March (Vane0326)


    This is exactly the way I wanted it to be…
    I presumed there would be a need for Helper columns in the Individual Tabs.

    Column C Column D Column E
    Runs Actual Runs Asterisk
    100* 100 *

    Now, one small change, I would like to suggest is to avoid having a separate column to input ‘*’.
    We can just input the Runs 100* as shown and just separate the Number and ‘*’.

    Keeping your Logic same by just changing the reference to the Column D instead of Column C.

    These are very simple formulas but can help the user to enter the Runs with asterisk.

    Formula to get only the Number

    [ = IF($C3="","",IF(ISNUMBER(RIGHT($C3)+0),"",LEFT($C3,LEN($C3)-1)+0))) ]

    Formula to get the Asterisk

    [=IF(RIGHT($C3,1)="*","*","") ]

    In your formula you can refer to the Column D which is a pure number and append the asterisk in the final result…

    But there some Anomalies as some Highest and Lowest scores are incorrect. I have already attached a file with the callouts for reference. I have also put all the scores in the Consolidation Tab so that you can do a Dry Run

    I would appreciate if you could please explain your formulas as what a particular code does in the entire line. I think there may be some Tabs which may be Hidden Can u please unhide those tabs if any, so that I can understand the working at a stretch..

    U had helped me earlier for getting the list of tabs

    http://www.excelforum.com/showthread.php?t=601696

    Good that Now I can also use the Dynamice List without displaying it..

    I believe this formula gives the Name of the New Tab which is added.
    [ = SUBSTITUTE(GET.WORKBOOK(1),"["&GET.WORKBOOK(16)&"]","") ]

    I need to understand these formulas and the concept if you could please please explain it..


    Criteria2

    [ = LARGE(IF(T(OFFSET(INDIRECT("'"&wks&"'!A3:A13"),ROW(INDIRECT("A3:A13"))-3,0,1))=Consolidation!$A3,N(OFFSET(INDIRECT("'"&wks&"'!C3:C13"),ROW(INDIRECT("C3:C13"))-3,0,1))),1) ]

    Criteria2

    [ = MIN(IF(T(OFFSET(INDIRECT("'"&wks&"'!A3:A13"),ROW(INDIRECT("A3:A13"))-3,0,1))=Consolidation!$A3,IF(N(OFFSET(INDIRECT("'"&wks&"'!C3:C13"),ROW(INDIRECT("C3:C13"))-3,0,1))>0,N(OFFSET(INDIRECT("'"&wks&"'!C3:C13"),ROW(INDIRECT("C3:C13"))-3,0,1))))) ]


    In the Cell B2

    [ { = LARGE(IF(TRANSPOSE(ROW(INDIRECT("1:"&COUNTA(wks))))<>MATCH("L&T",wks,0),IF(T(OFFSET(INDIRECT("'"&wks&"'!A3:A13"),ROW(INDIRECT("3:13"))-3,,1))=A2,N(OFFSET(INDIRECT("'"&wks&"'!C3:C13"),ROW(INDIRECT("3:13"))-3,,1)))),1)&F2 } ]
    In the Cell C2

    [ { =MIN(IF(TRANSPOSE(ROW(INDIRECT("1:"&COUNTA(wks))))<>MATCH("L&T",wks,0),IF(T(OFFSET(INDIRECT("'"&wks&"'!A3:A13"),ROW(INDIRECT("A3:A13"))-3,0,1))=A2,IF(N(OFFSET(INDIRECT("'"&wks&"'!C3:C13"),ROW(INDIRECT("C3:C13"))-3,0,1))>0,N(OFFSET(INDIRECT("'"&wks&"'!C3:C13"),ROW(INDIRECT("C3:C13"))-3,0,1))))))&G2 } ]


    Please aslo explain something about the Iteration Part

    Thanks a lot anyways for helping me out...
    But please revert...Im dying to understand the code...
    Attached Files Attached Files
    Last edited by all4excel; 04-01-2008 at 07:37 AM.

  7. #7
    Forum Contributor
    Join Date
    09-25-2004
    Posts
    269
    But there some Anomalies as some Highest and Lowest scores are incorrect. I have already attached a file with the callouts for reference. I have also put all the scores in the Consolidation Tab so that you can do a Dry Run

    Because I was ignoreing the wrong worksheet.


    I changed this formula


    TRANSPOSE(ROW(INDIRECT("1:"&COUNTA(wks))))<>MATCH("L&Twks,0)


    to this:


    TRANSPOSE(ROW(INDIRECT("1:"&COUNTA(wks))))<>MATCH("Consolidation",wks,0)

    Also can you add the additional columns with the formulas you're using then I would see if could it to work. If you would like to know more about these types of formulas try doing a search on other Excel fourms or just experiment with them thats how I learned.
    Attached Files Attached Files
    Last edited by vane0326; 04-01-2008 at 09:49 AM.

  8. #8
    all4excel
    Guest

    Smile

    Quote Originally Posted by vane0326
    Because I was ignoreing the wrong worksheet.


    I changed this formula


    TRANSPOSE(ROW(INDIRECT("1:"&COUNTA(wks))))<>MATCH("L&Twks,0)


    to this:


    TRANSPOSE(ROW(INDIRECT("1:"&COUNTA(wks))))<>MATCH("Consolidation",wks,0)

    Also can you add the additional columns with the formulas you're using then I would see if could it to work. If you would like to know more about these types of formulas try doing a search on other Excel fourms or just experiment with them thats how I learned.
    Vane,

    Have added the additional columns with the Number and the Asterisk seperately

    I have also understood about the Sheet you wanted to ignore..

    TRANSPOSE(ROW(INDIRECT("1:"&COUNTA(wks))))<>MATCH( "Consolidation",wks,0)

    Got It..!

    I think we can use this to validate this Sheet every time even when the Name is changed.

    [ RIGHT(CELL("filename",$C$2),LEN(CELL("filename",$C$2))-FIND("]",CELL("filename",$C$2),1))]

    Maybe a safer alternative would be

    [ MATCH( RIGHT(CELL("filename",$C$2),LEN(CELL("filename",$C$2))-FIND("]",CELL("filename",$C$2),1)),wks,0) ]

    There are still some anomalies...Please go through that and moreover the Columns F & G in the tab "Consolidation" have gone for a Toss.. because of the changes..
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    09-25-2004
    Posts
    269
    You need to add ths plus zero after your formula.

    Per example:

    =IF(RIGHT($C3,1)="*",LEFT($C3,LEN($C3)-1),$C3)+0


    It will corece your number as a true number. Also I adjusted the formulas to your suite.
    Attached Files Attached Files
    Last edited by vane0326; 04-01-2008 at 09:20 PM.

  10. #10
    all4excel
    Guest

    This is excellent work..!

    This is excellent work..!

    I was trying to get a solution for so many weeks but ultimately got it..
    I am really very happy as my Cricket Project is nearing completion..

    There are no more Anomalies everthing's working the way its intended to..

    Just one question though...
    I got the Highest and Lowest Scores...from you ..

    Can I use the same Analogy to get the Best Bowling Figures?

    Best bowling Figures--This would be based on the Number of wickets and the number of runs and should be displayed as 3-36 which means that the bowler took 3 wickets at the cost of 36 runs in a match..

    But if there are more than one occasion of taking the same number of wickets then the runs conceded should be given weightage..

    Example :
    1. 3-39
    2. 3-26

    Naturally 3-26 should be the Best bowling figures.

    Again if the runs are same then the number of wickets would be considered in the Best bowling figures.

    1. 3-36
    2. 1-36

    Naturally 3-36 should be the Best bowling figures..

    Now, Im sorry that Im asking you another question in the same thread the reason being you have already solved my first query and this is based on the same Logic of MAX and MIN..

    As explained above the Wickets taken by a Bowler are going to be crucial and are located in the Column K and the Runs given in Column N after all the Helper columns which are hidden in the five sheets.

    I had got this code from Daddylonglegs in this thread but this works in a Single Sheet...

    [ =MAX(Wickets)&"-"&MIN(IF(Wickets=MAX(Wickets),Runs Given)) ]

    With your help I can get Max wickets and Min Runs and then just append the two.

    http://www.excelforum.com/showthread.php?t=638316

    I'm attaching a File for reference if you could also help me on the same..

    Though you have already helped me on query..
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    09-25-2004
    Posts
    269
    I used the Max & Min Test4 file instead because it already has the helper columns in those worksheets.
    Attached Files Attached Files

  12. #12
    all4excel
    Guest

    Smile Dear vane..You are real quick!

    Quote Originally Posted by vane0326
    I used the Max & Min Test4 file instead because it already has the helper columns in those worksheets.

    Dear vane..You are real quick!

    I would appreciate if you explain the code as its really very complex and beyond my comprehension..

    I think that you have taken the Same Runs as the Batsman Scored...
    There's a column Runs Given (Column K) in each tab which needs to be used, which is the Runs given by a Bowler.

    However after the changes its working the way it is to work...

    Its perfect...!!!!!

    Great work....Dont have words to express..

    I dont think you have researched on this code ,I think its just a work of a real genious...
    You are the man...!

    Please help me with the explanation
    Last edited by all4excel; 04-02-2008 at 10:46 AM.

  13. #13
    all4excel
    Guest

    Smile

    Dear vane,

    Your formula works excellently, no doubts about it however when I tried to add it to my Sheet with other details its not getting added.

    I mean the Name---> Criteria3

    [ Criteria3-MAX(IF(TRANSPOSE(ROW(INDIRECT("1:"&COUNTA(Tabnames))))<>MATCH("Consolidation",Tabnames,0),IF(T(OFFSET(INDIRECT("'"&Tabnames&"'!A3:A13"),ROW(INDIRECT("3:13"))-3,0,1))=$A2,N(OFFSET(INDIRECT("'"&Tabnames&"'!H3:H13"),ROW(INDIRECT("3:13"))-3,0,1))))) ]

    I am able to add the formula but somehow not able to add the criteria it keeps on giving error..

    Im using Excel-2003...

    So please advise on the same...

  14. #14
    all4excel
    Guest

    Smile Dear Vane...

    Quote Originally Posted by vane0326
    I used the Max & Min Test4 file instead because it already has the helper columns in those worksheets.
    Please revert ....

    I have a New Query but I would be starting a New Thread, would appreciate if you help as you have done the major stuff..

    Its connected with the same file...

    Thanks a lot for all your help...

  15. #15
    Forum Contributor
    Join Date
    09-25-2004
    Posts
    269
    Quote Originally Posted by all4excel
    Dear vane,

    Your formula works excellently, no doubts about it however when I tried to add it to my Sheet with other details its not getting added.

    I mean the Name---> Criteria3

    [ Criteria3-MAX(IF(TRANSPOSE(ROW(INDIRECT("1:"&COUNTA(Tabnames))))<>MATCH("Consolidation",Tabnames,0),IF(T(OFFSET(INDIRECT("'"&Tabnames&"'!A3:A13"),ROW(INDIRECT("3:13"))-3,0,1))=$A2,N(OFFSET(INDIRECT("'"&Tabnames&"'!H3:H13"),ROW(INDIRECT("3:13"))-3,0,1))))) ]

    I am able to add the formula but somehow not able to add the criteria it keeps on giving error..

    Im using Excel-2003...

    So please advise on the same...

    You would have to check mark your Iteration in excel go to tools options and calculation. If not check mark it will give you a ref# error.


    Now if you don't want to use this option then we will need to list your worksheets.

  16. #16
    Forum Contributor
    Join Date
    09-25-2004
    Posts
    269
    Hi all4excel



    If you have Excel 2007 we would not have to check mark the Iteration but Excel 2003 we would have to. But here is an attachment below that using a reference list of worksheets.
    Attached Files Attached Files

  17. #17
    all4excel
    Guest

    Smile Dear Vane...

    Quote Originally Posted by vane0326
    Hi all4excel



    If you have Excel 2007 we would not have to check mark the Iteration but Excel 2003 we would have to. But here is an attachment below that using a reference list of worksheets.
    I am really greatful to you for all your help uptill now can u also help me in the other thread where I need the name of the tabs or sheets containing the Highest and Lowest Scores and best bowling figures..

    You have already worked on this Important portion...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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