+ Reply to Thread
Results 1 to 6 of 6

3 Conditions

  1. #1
    Registered User
    Join Date
    04-08-2009
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    15

    3 Conditions

    I have a problem where I have three conditions. For example: Using this data


    Please Login or Register  to view this content.

    I want to count the number of times Bob was either the Main or the Assit for jobs with the Status 1.

    When I just had two condition I was using this array to show how many time sBob was the Main for jobs with the Status 1.

    {=SUMPRODUCT(IF(A2:A6=1,1,0),IF(B2:B6="Bob",1,0))}

    But with the new added condition I want the formula to act like this although this does not work with excel:

    {=SUMPRODUCT(IF(A2:A6=1,1,0),IF(B2:B6="Bob",1,0) or (IF(C2:C6="Bob",1,0)))}

    Sorry if that was confusing....Any ideas?
    Last edited by Eamster; 04-08-2009 at 07:29 PM.

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

    Re: 3 Conditions

    try
    =SUMPRODUCT((A2:A6=1)*(B2:B6="bob")+(C2:C6="bob"))
    "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

  3. #3
    Registered User
    Join Date
    04-08-2009
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: 3 Conditions

    That seemed to work in that instance but if you try it with this data (I had to change my data for another example) using status 5:
    Please Login or Register  to view this content.
    If you try your formula =SUMPRODUCT((A2:A6=5)*(B2:B6="bob")+(C2:C6="bob"))

    It comes up with the answere of 3 when there should only be 2 because bob was the main or assist on only 2 jobs where the status was 5.

    In other words it should only count if the Status is 5 and bob is in either the Main or Assist catagory.
    Last edited by Eamster; 04-08-2009 at 07:56 PM.

  4. #4
    Valued Forum Contributor ffffloyd's Avatar
    Join Date
    05-20-2008
    Location
    Melbourne, VIC, Australia
    MS-Off Ver
    Office 365
    Posts
    243

    Re: 3 Conditions

    Forgive me interrupting but shouldn't there be an extra level of brackets around the '+' terms?

    =SUMPRODUCT((A2:A6=1)*((B2:B6="bob")+(C2:C6="bob")))

    Otherwise it is effectively saying "TRUE if Status = 1 and Main = 'Bob', or if Assist = 'Bob' and never mind what the Status is".

  5. #5
    Registered User
    Join Date
    04-08-2009
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: 3 Conditions

    I think we have a winner! So far it looks to be working. Thanks for both of your help! Much Appreciated!

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

    Re: 3 Conditions

    well it was 12:30 a.m. and i'd been in the pub!

+ 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