+ Reply to Thread
Results 1 to 6 of 6

Excel 2007 : Want to Use Sumproduct with Min function.

  1. #1
    Registered User
    Join Date
    01-12-2012
    Location
    United Arab Emirates
    MS-Off Ver
    Excel 2007
    Posts
    3

    Want to Use Sumproduct with Min function.

    Dear all
    I am working with an Excel Sheet, where I want to find out Minimum, Maximum, and Average Number of a specific Column, given a specific criteria.
    I am using the following formula and am able to get the Maximum Value from a specific column.
    Now when I try to find Minimum, it always give me Zero Value.

    The formula which is displaying the Maximum Value is this..
    {=MAX((Sheet1!$D$3:$D$503>=(--$K$4))*((Sheet!!$D$3:$D$503<=(--$Q$4))*((Sheet1!$F$3:$F$503=$D$4))*(Sheet1!$E$3:$E$503=C15)*(Sheet1!$AM$3:$AM$503)))}
    Where:
    $K$4 and $Q$4 are dates (To search between dates)
    $D$4 is first criteria
    C15 is second criteria
    and $AM$3:$AM$503 is the column from where its getting the maximum value.

    When I use the same above formula with MIN, the result is always Zero, which is not correct according to my data.

    Thanks in advance for help.

  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: Want to Use Sumproduct with Min function.

    Ηι nazpak and welcome to the forum.

    Would you like to upload a sample workbook?
    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
    01-12-2012
    Location
    United Arab Emirates
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Want to Use Sumproduct with Min function.

    Thanks for your response Fotis.
    Please see attached
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Want to Use Sumproduct with Min function.

    Your MIN function is returning a zero, because any rows in the array that don't meet all of the criteria return a zero value, so you need to use an IF statement to return a higher value than any you'll encounter elsewhere in the array.

    This function does that:

    {=MIN(INDEX(IF((MainData!$B$2:$B$31>=$D$4)*(MainData!$B$2:$B$31<=$D$5)*(MainData!$D$2:$D$31=$D$3)*(LstPQ=C8)>0,MainData!$F$2:$F$31,MAX(MainData!$F$2:$F$31)+1),0))}

    However, that will return a value of 90 when there are no matches in the data set. To get around this we can use a COUNTIFS to check that the number of matches is greater than zero...

    {=IF(COUNTIFS(MainData!$B$2:$B$31,">=" & $D$4,MainData!$B$2:$B$31,"<=" & $D$5, MainData!$D$2:$D$31,$D$3,LstPQ,C8)=0,0,MIN(INDEX(IF((MainData!$B$2:$B$31>=$D$4)*(MainData!$B$2:$B$31<=$D$5)*(MainData!$D$2:$D$31=$D$3)*(LstPQ=C8)>0,MainData!$F$2:$F$31,MAX(MainData!$F$2:$F$31)+1),0)))}

    That seems to work fine.

    Both of these are array formula and must be entered using Ctrl-Shift-Enter.

    Hope this helps.

  5. #5
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Want to Use Sumproduct with Min function.

    =MIN(IF((MainData!$B$2:$B$31>=(--$D$4))*(MainData!$B$2:$B$31<=(--$D$5))*(MainData!$D$2:$D$31=$D$3)*(MainData!$C$2:$C$31=C8),MainData!$F$2:$F$31,""))
    array-entered should also work.
    Good luck.

  6. #6
    Registered User
    Join Date
    01-12-2012
    Location
    United Arab Emirates
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Want to Use Sumproduct with Min function.

    Thank you both Andrew and OnErrorGoto0
    Both solutions worked perfectly.
    I was banging my head with Sumproduct, cuz I already got Max Value from it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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