+ Reply to Thread
Results 1 to 9 of 9

Add another Condition Column to Sumproduct formula

  1. #1
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Add another Condition Column to Sumproduct formula

    This is my working formula
    Please Login or Register  to view this content.

    I want to make it an OR condition by having $R$3:$R$28=88676 as another option. I've tried the following formula.
    Please Login or Register  to view this content.
    and

    Please Login or Register  to view this content.
    I'm getting a value error and can't figure out where the problem is.

    Any help is appreciated.

    Thanks,
    BDB
    Last edited by bdb1974; 06-23-2009 at 06:00 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Add another Condition Column to Sumproduct formula

    Can't fathom your actual data, but if it's just an extension you want, this seem to be usable:

    =SUMPRODUCT(--($R$3:$R$28=88398)--($R$3:$R$28=88397),N$3:N$28,$P$3:$P$28)

    By leaving out the comma and adding a second criteria, it acts like an AND.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Add another Condition Column to Sumproduct formula

    Yes, That's exactly what I needed with a little cell referencing corrections.
    Please Login or Register  to view this content.
    Thanks,

    BDB

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Add another Condition Column to Sumproduct formula

    Glad you have resolved - the more traditional syntax for an OR would be along the lines of:

    =SUMPRODUCT(($R$3:$R$30=88676)+($S$3:$S$30=88676),O$3:O$30,$P$3:$P$30)

    I only highlight this in case you come across other examples.

    The first double unary in JB's examples could be disposed of as the second -- acts as a + and thus coerces both Boolean arrays.

    It's worth pointing out though that if both R & S = 88676 you will be double counting the result of O*P.
    Last edited by DonkeyOte; 06-23-2009 at 06:14 PM.

  5. #5
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Add another Condition Column to Sumproduct formula

    Thanks Donkey Ote for sharing your knowledge.

    Yes, the following is true for both examples
    Please Login or Register  to view this content.
    Is there a way to write the formula so having 2 of the same values will not cause it to double count. Just Curious. - BDB

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Add another Condition Column to Sumproduct formula

    There will definitely be better methods but I'm struggling today if truth be told...

    =SUMPRODUCT(--(ISNUMBER(SEARCH(":88676:",":"&$R$3:$R$30&":"&$S$3:$S$30&":"))),O$3:O$30,$P$3:$P$30)

  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,976

    Re: Add another Condition Column to Sumproduct formula

    Or:
    =SUMPRODUCT(SIGN(($R$3:$R$30=88676)+($S$3:$S$30=88676)),O$3:O$30,$P$3:$P$30)
    Everyone who confuses correlation and causation ends up dead.

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Add another Condition Column to Sumproduct formula

    much more elegant (& efficient)... thanks R.

  9. #9
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,976

    Re: Add another Condition Column to Sumproduct formula

    I'm having one of those days where I have flashes of competence!

+ 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