+ Reply to Thread
Results 1 to 5 of 5

SUMIFS with OR in criteria

Hybrid View

  1. #1
    Registered User
    Join Date
    08-31-2012
    Location
    Ukraine
    MS-Off Ver
    2013
    Posts
    23

    SUMIFS with OR in criteria

    Hello.

    I came across a problem today and haven't found an easy way to solve it.
    I have this formula:
    =SUMIFS('Sheet 1'!H:H,'Sheet 1'!E:E,Sheet2!I4)+SUMIFS('Sheet 1'!H:H,'Sheet 1'!E:E,Sheet2!I5)+SUMIFS('Sheet 1'!H:H,'Sheet 1'!E:E,Sheet2!I6)+SUMIFS('Sheet 1'!H:H,'Sheet 1'!E:E,Sheet2!I7)
    I'd like to make this formula smaller by doing something like this:
    =SUMIFS('Sheet 1'!H:H,'Sheet 1'!E:E,OR(Sheet2!I4,Sheet2!I5,Sheet2!I6,Sheet2!I7))
    But it doesn't work this way. Can I make something similar that will work?

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

    Re: SUMIFS with OR in criteria

    Try this version

    =SUMPRODUCT(SUMIFS('Sheet 1'!H:H,'Sheet 1'!E:E,Sheet2!I4:I7))

    If you use the 4 cell range as the criteria the SUMIFS actually returns an "array" of 4 values.....so SUMPRODUCT is just used here to sum that array. Note with only one criteria range you could also use SUMIF
    Audere est facere

  3. #3
    Registered User
    Join Date
    08-31-2012
    Location
    Ukraine
    MS-Off Ver
    2013
    Posts
    23

    Re: SUMIFS with OR in criteria

    Thanks, it does work.
    However I investigated this a bit more, and came to the same result by entering just =SUMIFS('Sheet 1'!H:H,'Sheet 1'!E:E,Sheet2!I4:I7)
    but as an array, by pressing CTRL+Shift+Enter after entering the formula.

    I don't have a lot of data in that file so far to fully test if it works as supposed.

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

    Re: SUMIFS with OR in criteria

    Quote Originally Posted by SergSlim View Post
    =SUMIFS('Sheet 1'!H:H,'Sheet 1'!E:E,Sheet2!I4:I7)
    I don't believe that will work, array entered or not - what you'll get is just the sum for the first criterion, i.e. where the match is with Sheet2!I4, as per my reply you need to wrap the formula in a SUMPRODUCT function (or a SUM function and "array enter")

  5. #5
    Registered User
    Join Date
    08-31-2012
    Location
    Ukraine
    MS-Off Ver
    2013
    Posts
    23

    Re: SUMIFS with OR in criteria

    Yeah, actually you are right. It just happened that I tested it with data that was in I4. Changed it to I5 - and it showed 0. In that case I'll go with your proposed version. Thanks again.

+ 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