+ Reply to Thread
Results 1 to 4 of 4

Smarter Way of Writing This Sumproduct Formula

  1. #1
    Forum Contributor
    Join Date
    10-09-2010
    Location
    London
    MS-Off Ver
    Excel Version Office 365
    Posts
    211

    Smarter Way of Writing This Sumproduct Formula

    Can anyone suggest a smarter way of writing this SUMPRODUCT formula that has AND / OR within it.

    My intention was to have a formula such as:

    =SUMPRODUCT(($C$2:$C$126=$O131)*($I$2:$I$126=P$130)*($AF$2:$AF$126="Missing")*$H$2:$H$126)-SUMPRODUCT(($C$2:$C$126=$O131)*($I$2:$I$126=P$130)*($AG$2:$AG$126="Resigned", "Leaver", "Transfer")*$H$2:$H$126)


    I am trying to show Resigned, Leaver and Transfer combined.


    =SUMPRODUCT(($C$2:$C$126=$O131)*($I$2:$I$126=P$130)*($AF$2:$AF$126="Missing")*$H$2:$H$126)-SUMPRODUCT(($C$2:$C$126=$O131)*($I$2:$I$126=P$130)*($AG$2:$AG$126="Resigned")*$H$2:$H$126)+-SUMPRODUCT(($C$2:$C$126=$O131)*($I$2:$I$126=P$130)*($AG$2:$AG$126="Leaver")*$H$2:$H$126)+-SUMPRODUCT(($C$2:$C$126=$O131)*($I$2:$I$126=P$130)*($AG$2:$AG$126="Transfer")*$H$2:$H$126)


    If there is not, please let me know. I am sure with so many smart individuals on this forum, one could suggest an alternative.

    Thanks

  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: Smarter Way of Writing This Sumproduct Formula

    (ISNUMBER(SEARCH({"Resigned","Leaver","Transfer"},$AG$2:$AG$126)))
    "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
    Forum Contributor
    Join Date
    10-09-2010
    Location
    London
    MS-Off Ver
    Excel Version Office 365
    Posts
    211

    Re: Smarter Way of Writing This Sumproduct Formula

    Thankk you for your suggestion. I have incorporated your idea as shown below. However it does not seem to be subtracting the amount from columns AG

    =SUMPRODUCT(($C$2:$C$126=$O134)*($I$2:$I$126=AC$130)*($AF$2:$AF$126="Missing")*$H$2:$H$126)-SUMPRODUCT(($C$2:$C$126=$O134)*($I$2:$I$126=AC$130)*($AG$2:$AG$126=(ISNUMBER(SEARCH({"Resigned","Leaver","Transfer"},$AG$2:$AG$126))))*$H$2:$H$126)

    Would you know what I am doing wrong please?

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

    Re: Smarter Way of Writing This Sumproduct Formula

    ($AG$2:$AG$126=(ISNUMBER(SEARCH({"Resigned","Leaver","Transfer"},$AG$2:$AG$126))

    is just
    (ISNUMBER(SEARCH({"Resigned","Leaver","Transfer"},$AG$2:$AG$126))) you dont use the first bit

    =SUMPRODUCT(($C$2:$C$126=$O134)*($I$2:$I$126=AC$130)*($AF$2:$AF$126="Missing")*$H$2:$H$126)-SUMPRODUCT(($C$2:$C$126=$O134)*($I$2:$I$126=AC$130)*(ISNUMBER(SEARCH({"Resigned","Lea ver","Transfer"},$AG$2:$AG$126)))*$H$2:$H$126)

+ 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