+ Reply to Thread
Results 1 to 4 of 4

Sumproduct function, subtracting based on condition met

  1. #1
    Registered User
    Join Date
    10-25-2010
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    13

    Sumproduct function, subtracting based on condition met

    Hi All,

    I am using the sumproduct function as in the attached spreadsheet, in the summary calculations (bottom in yellow).

    For the expenses summary, I wish to add the following to my function:
    For example the [Food] criteria: function calculates as it does at the moment, however, if there is a figure in the "Share Amount" column (i.e. a value >0), the function will subtract this amount from the [Food] total.

    So, because rows 3 and 11 have a figure greater than 0, the total below should be less $87.

    I hope I have explained the requirements correctly?

    Any help is greatly appreciated.
    Rob
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Sumprouduct function, subtracting based on condition met

    Hi,in G25 you could try

    =SUMPRODUCT(--(LEFT($J$3:$J$79;6)="[Food]");$C$3:$C$79-$H$3:$H$79)
    Hope it helps

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

    Re: Sumprouduct function, subtracting based on condition met

    Rob, based on the revised requirements:

    Please Login or Register  to view this content.
    FWIW, in terms of the original formulae (ie prior to above requirement) you would have been better off using SUMIF than SUMPRODUCT as the former is more efficient.

    If you wanted you could store the criteria strings in an adjacent column and replace the constant [Food] with reference to the criteria cell - this will allow you to copy & paste accordingly without needing to adjust remaining formulae.

  4. #4
    Registered User
    Join Date
    10-25-2010
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Sumprouduct function, subtracting based on condition met

    Canapone - thanks, that's perfect! I didn't realise it was so simple (thought I had to integrate an IF statement in there).

    DonkeyOte - also thanks, I have little experience with SUMIF however have begun to use it in other workbooks so I might try experiment with it in this

+ 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