+ Reply to Thread
Results 1 to 23 of 23

Min with sumproduct

  1. #1
    Forum Contributor
    Join Date
    12-06-2012
    Location
    sacramento,calif
    MS-Off Ver
    Excel 2010
    Posts
    217

    Min with sumproduct

    Hi, I need a formula that finds the minimum from one col if criteria is met in another col, example:

    A1:A4: 3,2,4,1
    B1:B4: B,C,A,D

    If the criteria I need is "D" and the minimum for the whole set of A1:A4 (which is 1 above) corresponds, then true.

    I don't need the min only for the group D, example:

    A1:A4: 1,2,4,5
    B1:B4: B,D,A,D

    Here the min for "D" is 2 but it is not the min for the whole set, I don't want that. I want only if "D" is matched with "1".
    Thanks.
    Last edited by JJGF; 03-08-2015 at 03:49 PM.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Min with sumproduct

    How about...

    =MIN(IF(B1:B4="D",A1:A4))

    IMPORTANT
    This is an array formula
    Enter the formula >> press F2 then >> CTRL + SHIFT + ENTER
    If entered correctly, the formula will be enclosed in {brackets}
    Do not enter the {brackets} manually
    HTH
    Regards, Jeff

  3. #3
    Forum Contributor
    Join Date
    12-06-2012
    Location
    sacramento,calif
    MS-Off Ver
    Excel 2010
    Posts
    217

    Re: Min with sumproduct

    Quote Originally Posted by jeffreybrown View Post
    How about...

    =MIN(IF(B1:B4="D",A1:A4))
    No, this returns the wrong result.

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Min with sumproduct

    I want only if "D" is matched with "1".
    Maybe some more explaining is necessary then. I don't follow

  5. #5
    Forum Contributor
    Join Date
    12-06-2012
    Location
    sacramento,calif
    MS-Off Ver
    Excel 2010
    Posts
    217

    Re: Min with sumproduct

    Quote Originally Posted by jeffreybrown View Post
    Maybe some more explaining is necessary then. I don't follow
    Sorry, I don't know how to explain it any better than I already have.

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Min with sumproduct

    Why not explain it with a few more examples thru a workbook?

    Either that or maybe somebody else can give it a go...

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Min with sumproduct

    Quote Originally Posted by JJGF View Post
    No, this returns the wrong result.
    What did it return, and what were you expecting?

    Did you use CTRL SHIFT ENTER to enter this, and not just enter?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,419

    Re: Min with sumproduct

    Maybe:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  9. #9
    Forum Contributor
    Join Date
    12-06-2012
    Location
    sacramento,calif
    MS-Off Ver
    Excel 2010
    Posts
    217

    Re: Min with sumproduct

    Quote Originally Posted by TMS View Post
    Maybe:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Regards, TMS
    works when there is only 1 min number that matches D. If there is more than one min it won't work: example 1,1,3,4 with B,D,C,A.

  10. #10
    Forum Contributor
    Join Date
    12-06-2012
    Location
    sacramento,calif
    MS-Off Ver
    Excel 2010
    Posts
    217

    Re: Min with sumproduct

    Ok here is a workbook attached.
    Attached Files Attached Files

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Min with sumproduct

    JJGF, did you see post # 7?

  12. #12
    Forum Contributor
    Join Date
    12-06-2012
    Location
    sacramento,calif
    MS-Off Ver
    Excel 2010
    Posts
    217

    Re: Min with sumproduct

    Quote Originally Posted by FDibbins View Post
    JJGF, did you see post # 7?
    yes, check my workbook please.

  13. #13
    Forum Contributor
    Join Date
    12-06-2012
    Location
    sacramento,calif
    MS-Off Ver
    Excel 2010
    Posts
    217

    Re: Min with sumproduct

    I believe I have found a solution and without CSE:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Returns a 1 when true otherwise returns nothing (with Excel 2010 at least).

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Min with sumproduct

    OK, well you have been asked a few different questions, a few different times, without providing any answers to them. We are here to help, but only if you help us to help you.

    Like Jeff, I will now leave this to someone else, maube they can read your mind better than we can - good luck

  15. #15
    Forum Contributor
    Join Date
    12-06-2012
    Location
    sacramento,calif
    MS-Off Ver
    Excel 2010
    Posts
    217

    Re: Min with sumproduct

    Quote Originally Posted by FDibbins View Post
    OK, well you have been asked a few different questions, a few different times, without providing any answers to them. We are here to help, but only if you help us to help you.

    Like Jeff, I will now leave this to someone else, maube they can read your mind better than we can - good luck
    Not sure if you are unable to see my replies, but I responded to you in post#12, provided a workbook example in post#10 and I posted my own solution in post#13. Sorry if you are having trouble.

  16. #16
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,419

    Re: Min with sumproduct

    Glad you have found a solution to your problem.

    Please bear in mind that, if you provide sample data that does not represent the problem you wish to address, you will get solutions offered that do not meet your needs. And, in the process, you are likely to alienate the people you are looking to for an answer. Even when you did provide a sample workbook, the data was not truly representative of the scenario you need to address.

    Regards, TMS

  17. #17
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Min with sumproduct

    Nope, not having any trouble at all

  18. #18
    Forum Contributor
    Join Date
    12-06-2012
    Location
    sacramento,calif
    MS-Off Ver
    Excel 2010
    Posts
    217

    Re: Min with sumproduct

    Quote Originally Posted by TMS View Post
    Glad you have found a solution to your problem.

    Please bear in mind that, if you provide sample data that does not represent the problem you wish to address, you will get solutions offered that do not meet your needs. And, in the process, you are likely to alienate the people you are looking to for an answer. Even when you did provide a sample workbook, the data was not truly representative of the scenario you need to address.



    Regards, TMS
    That is your opinion, the sample workbook explained everything perfectly.

  19. #19
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,419

    Re: Min with sumproduct

    That is your opinion, ...
    Yep.

    ... the sample workbook explained everything perfectly.
    Nope. The data and explanation seems, as far as I can see, to reflect your original post. However, it does not cater for duplicate values as described in your post #9.

    But, worry not about my opinion, and I will worry not about your problems

  20. #20
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Min with sumproduct

    JJFG, a word of advice to CLOSE off this thread...

    When members ask for additional info, it is often best to try and answer IN the post, rather than making them open up a file unnecessarily.

    Stating "it didnt work" is hardly descriptive of what happened, as compared to "It didnt work as expected, it should have returned xx, but instead returned yy".
    Most experienced members here have enough knowledge that they can probably figure out what went wrong just by what you said you got vs what you wanted.

    Im sure it was not your intention, but it appears that you have ruffled more than a few feathers here, which is not very condusive to getting any future help you might need

    Again, I am happy you got your question resolved, enjoy your stay with us

    I believe this thread is now concluded?

  21. #21
    Forum Contributor
    Join Date
    12-06-2012
    Location
    sacramento,calif
    MS-Off Ver
    Excel 2010
    Posts
    217

    Re: Min with sumproduct

    Quote Originally Posted by FDibbins View Post
    JJFG, a word of advice to CLOSE off this thread...

    When members ask for additional info, it is often best to try and answer IN the post, rather than making them open up a file unnecessarily.

    Stating "it didnt work" is hardly descriptive of what happened, as compared to "It didnt work as expected, it should have returned xx, but instead returned yy".
    Most experienced members here have enough knowledge that they can probably figure out what went wrong just by what you said you got vs what you wanted.

    Im sure it was not your intention, but it appears that you have ruffled more than a few feathers here, which is not very condusive to getting any future help you might need

    Again, I am happy you got your question resolved, enjoy your stay with us

    I believe this thread is now concluded?
    I thought I explained it enough, sorry if it was inadequate, you can delete the thread if it helps. BTW, I have gotten help from this forum before and greatly appreciated it, not sure what happened today. Maybe the question was too confusing, sorry about that.

  22. #22
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Min with sumproduct

    We all have "off" days when we think what we said was pretty obvious (but was not lol) - and I mean from both sides here. Thanks for the understanding

    No harm done, we look forward to assisting you in the future

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

    Re: Min with sumproduct

    Quote Originally Posted by JJGF View Post
    =IF(MIN(A1:A4)=AGGREGATE(15,6,A1:A4/(B1:B4="D"),1),1,"")
    Perhaps also try COUNTIFS like this

    =IF(COUNTIFS(A1:A4,MIN(A1:A4),B1:B4,"D"),1,"")

    That will give you the same results except if you have no "D" in B1:B4 - in which case my suggestion returns a blank rather than an error
    Audere est facere

+ 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. Count SUMPRODUCT Members / Average of SUMPRODUCT
    By Shingaru in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-10-2014, 03:59 PM
  2. Replies: 1
    Last Post: 05-19-2012, 02:54 AM
  3. Replies: 5
    Last Post: 04-20-2012, 08:54 AM
  4. Replies: 6
    Last Post: 03-09-2011, 08:01 AM
  5. Using a SumProduct Count to find a SumProduct Total?
    By XL021710 in forum Excel General
    Replies: 3
    Last Post: 02-18-2010, 08:31 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