+ Reply to Thread
Results 1 to 2 of 2

SUMIFS with multiple or/and/not Criteria

  1. #1
    Registered User
    Join Date
    07-20-2010
    Location
    Oklahoma City
    MS-Off Ver
    Excel 2007
    Posts
    6

    SUMIFS with multiple or/and/not Criteria

    I am stumped. It seems like I have tried ever feasible combination with no joy. I dug into a few other options such as DSUM and was reading into array and pivot, but I am too far from being knowlegeable enough to go there.

    I am trying to Count (COUNTIF) and Sum (SUMIFS) Column 'A' when Column 'B' is either "X" or "Y" or "Z" and Column 'C' is not "000" or "030" or "087" . . . . or "877" (a total of 45 exceptions) and Column 'D' is "1"

    If I use an OR("X","Y","Z") it returns True or False and I get zero.
    If I use ("X"+"Y"+"Z"), I get zero.
    I have tried multiple formats with the exception list also with no joy. ("<>000","<>030", "<>087")

    Here is the formula before the exception list is introduced:
    =SUM(SUMIFS($A:$A, $B:$B,"X", $D:$D, "1"),SUMIFS($A:$A, $B:$B,"Y", $D:$D, "1"), SUMIFS($A:$A, $B:$B,"Z", $D:$D, "1"))

    When I tried to use SUMIFS($A:$A, $B:$B, "X", $B:$B "Y", $B:$B, "Z", $D:$D, "1") it returned zero records.

    The closest I have come listed each of the criteria in Column B (X, Y, Z) with the entire exception list of 45 items ("000", "030", "877" etc) and failed because it exceeded 255 characters. I even tried to splice it together using &""& or &","& but SUMIFS was not real happy.

    I have also tried using a table array and it didnt come out right.

    I must accept the data I am working with as text because the data in column 'C' can be alphanumeric.

    Thanks for your time, in advance.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: SUMIFS with multiple or/and/not Criteria

    I'd try SUMPRODUCT

    List the 3 possibilities for column B in F2:F4 and the 45 exceptions for column C in G2:G46 then use

    =SUMPRODUCT(ISNUMBER(MATCH(B2:B1000,F2:F4,0))+0,ISNA(MATCH(C2:C1000,G2:G46,0))+0,(D2:D1000="1"), A2:A1000)

    adjust ranges as necessary

    Note that G2:G46 should match the format of column C so you should pre-format as text, I assume column D is text formatted, otherwise remove quotes from "1". For a count just remove ,A2:A1000
    Audere est facere

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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