+ Reply to Thread
Results 1 to 3 of 3

Using SUMPRODUCT for horizontal and vertical conditions TWICE

  1. #1
    Registered User
    Join Date
    03-25-2006
    Posts
    32

    Using SUMPRODUCT for horizontal and vertical conditions TWICE

    Here's what i'm trying to do with no luck even with scouring the internet:

    Column A B C D E F
    row 1 20 25 30 40 45 50
    row 2 A B C A B N/A
    row 3 B B C B B C
    row 4 A B C A C A


    I'm trying to find all instances where I have an "A" @ 20 and also an "N/A" @ 50, now i can do that using a simple sumproduct with something like:

    =SUMPRODUCT((A2:A4="A")*(F2:F4="N/A))
    = 1

    However i need to make this formula dynamic for analysis purposes. What if i wanted to see an "A" @ 25 and also an "A" @ 45? I don't want to manually go into the formula and change the ranges, i need the formula to be able to adjust dynamically based on inputs.

    So essentially inputs would be in a different area and the sumproduct would return the result based on the inputs changing. My problem is i don't know how to get sumproduct to use two horizontal conditions & two vertical conditions at once. In this example i need something to do this:

    =SUMPRODUCT((A1:F1=20)*(A2:F2="A") AND SUMPRODUCT((A1:F1=50)*(A2:F2="N/A")

    How do i get this all combined into 1 neat formula that works?

    Thanks so much!
    Last edited by jim_0068; 04-06-2011 at 10:08 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Using SUMPRODUCT for horizontal and vertical conditions TWICE

    Try something like this:

    Assuming you want to get all the "A" in column 20 and "N/a" in column 50, and your table is in A1:F4

    Then assuming you enter your inputs like this:

    in B9: 25 and in C9: 50
    in B10: A and in C10: N/A

    Then use formula:

    =SUMPRODUCT(--(INDEX($A$2:$F$4,0,MATCH(B9,$A$1:$F$1,0))=B10),--(INDEX($A$2:$F$4,0,MATCH(C9,$A$1:$F$1,0))=C10))
    Attached Files Attached Files
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    03-25-2006
    Posts
    32

    Re: Using SUMPRODUCT for horizontal and vertical conditions TWICE

    That works PERFECT! Thanks so much.

+ 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