+ Reply to Thread
Results 1 to 7 of 7

Nested SUMIF statement or multiple SUMIF's

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-14-2008
    Location
    Manchester, England
    MS-Off Ver
    2007
    Posts
    110

    Nested SUMIF statement or multiple SUMIF's

    Hello all

    I was hoping someone would be able to help me. I need to perform 2 SUMIF's on 2 columns of data to return a result and I'm not quite sure the best way of doing this. I'll give an example below.

    I have 2 columns of data, both numeric and the SUMIF needs to say if H1:H100="10" and also if J1:J100="907". I can perform one or the other but not both.

    Thanks in advance

    Dan
    Last edited by Dan27; 09-17-2009 at 06:56 AM.

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

    Re: Nested SUMIF statement or multiple SUMIF's

    Which XL version are you using ?

    What is the range to be summed ?

  3. #3
    Forum Contributor
    Join Date
    02-14-2008
    Location
    Manchester, England
    MS-Off Ver
    2007
    Posts
    110

    Re: Nested SUMIF statement or multiple SUMIF's

    I'm using Excel 2003. The range is actually 20k but I used 100 to simplify my question.

    Thanks

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

    Re: Nested SUMIF statement or multiple SUMIF's

    You said you need to SUMIF - you have given us 2 conditional ranges for the criteria but not the range for summation... do you then mean a COUNTIF ?

    =SUMPRODUCT(--(H1:H20000=10),--(J1:J100=907))

    SUMPRODUCT used with large ranges will lead to poor performance... you will be best served adding a concatenation column at source, eg:

    K1: =H1&"@"&J1
    copied down

    and then use a traditional COUNTIF

    =COUNTIF(K1:K20000,"10@907")

    which will be far more efficient.

  5. #5
    Forum Contributor
    Join Date
    02-14-2008
    Location
    Manchester, England
    MS-Off Ver
    2007
    Posts
    110

    Re: Nested SUMIF statement or multiple SUMIF's

    Sorry for not being clear DonkeyOte.

    To be exact it would be =SUMIF(I1:I20000,"10" and J1:J20000,"907" then sum range K1:K20000

    Thanks

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

    Re: Nested SUMIF statement or multiple SUMIF's

    OK so using SUMPRODUCT simply add the final range, eg:

    =SUMPRODUCT(--(H1:H20000=10),--(J1:J20000=907),K1:K20000)

    using concatenation (advised) where concatenated strings in L rather than K (given values to sum in K):

    =SUMIF(L1:L20000,"10@907",K1:K20000)

    this will be far more efficient (ie concatenation negates need for SUMPRODUCT/Array formulae)

  7. #7
    Forum Contributor
    Join Date
    02-14-2008
    Location
    Manchester, England
    MS-Off Ver
    2007
    Posts
    110

    Re: Nested SUMIF statement or multiple SUMIF's

    Thanks for this. It works great and makes more sense. I wasn't thinking outside the box!

+ 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