+ Reply to Thread
Results 1 to 6 of 6

SumIf with more than one condition

  1. #1
    Registered User
    Join Date
    10-09-2008
    Location
    blah
    Posts
    7

    SumIf with more than one condition

    Hi, I'm trying create a Sum(If formula with 2 conditions, but whatever I try doesn't seem to want to cooperate. I want to add up the sum of all invoices according to the country they deal with and the month that they were created in. I've attached a sample file showing what I'm trying to accomplish.
    Here is how far I've gotten so far:
    =SUM(IF(Main!$L:$L;B21*Main!$Z:$Z;C20);Main!$H:$H)

    I've tried other forms as well but even though this only returns #Value!, at least the formula is accepted.

    Any help would be greatly appreciated!
    Attached Files Attached Files
    Last edited by NBVC; 05-12-2009 at 10:02 AM.

  2. #2
    Forum Contributor
    Join Date
    04-16-2009
    Location
    Stellenbosch, South Africa
    MS-Off Ver
    Excel 2003; Excel 2007; Excel 2010; Excel 2013
    Posts
    136

    Re: SumIf with more than one condition

    This applies to the sample that you provided.

    In cell J5:

    =SUMPRODUCT(--($D$5:$D$21=$J$4),--($E$5:$E$21=$I5),$C$5:$C$21)
    Regards

    Jon (Excel 2003, 2007, 2010, 2013)

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,058

    Re: SumIf with more than one condition

    Try this:

    =SUMPRODUCT(--($E$5:$E$21=$I5);--($D$5:$D$21=J$4);$C$5:$C$21)
    Never use Merged Cells in Excel

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

    Re: SumIf with more than one condition

    If your intention is create a matrix I would advise 2 alternative approaches to SUMPRODUCT... namely (in order of preference)

    1. Pivot Table (country as Row Field, Month as Column Field and Amount as Data Field)

    2. Concatenation & SUMIF, ie

    F5: =$E5&":"&$D5
    copy down

    J5: =SUMIF($F$5:$F$21,$I5&":"&J$4,$C$5:$C$21)
    copy down

    SUMPRODUCTS when used in large quantities will affect (adversely) the performance of your file, a Pivot Table is invariably the best solution available... failing that using Concatenation and a standard SUMIF approach will be more efficient if less-elegant... pending volumes of data in play the difference in performance can be immense.

  5. #5
    Registered User
    Join Date
    10-09-2008
    Location
    blah
    Posts
    7

    Re: SumIf with more than one condition

    wow, thanks a lot guys, great help!

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,058

    Re: SumIf with more than one condition [SOLVED]

    For solving go at first post, edit -> go advanced and choose [solved]from drop down menu

+ 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