Using SUMIFS with multiple AND OR conditions

前端 未结 7 2220
青春惊慌失措
青春惊慌失措 2020-12-10 15:50

I would like to create a succinct Excel formula that SUMS a column based on a set of AND conditions, plus a set of OR conditions.

My Excel table contains the followi

相关标签:
7条回答
  • 2020-12-10 16:01

    You might consider referencing the actual date/time in the source column for Quote_Month, then you could transform your OR into a couple of ANDs, something like (assuing the date's in something I've chosen to call Quote_Date)

    =SUMIFS(Quote_Value,"<=90",Quote_Date,">="&DATE(2013,11,1),Quote_Date,"<="&DATE(2013,12,31),Salesman,"=JBloggs",Days_To_Close)
    

    (I moved the interesting conditions to the front).

    This approach works here because that "OR" condition is actually specifying a date range - it might not work in other cases.

    0 讨论(0)
  • 2020-12-10 16:01

    In order to get the formula to work place the cursor inside the formula and press ctr+shift+enter and then it will work!

    0 讨论(0)
  • 2020-12-10 16:03

    With the following, it is easy to link the Cell address...

    =SUM(SUMIFS(FAGLL03!$I$4:$I$1048576,FAGLL03!$A$4:$A$1048576,">="&INDIRECT("A"&ROW()),FAGLL03!$A$4:$A$1048576,"<="&INDIRECT("B"&ROW()),FAGLL03!$Q$4:$Q$1048576,E$2))
    

    Can use address / substitute / Column functions as required to use Cell addresses in full DYNAMIC.

    0 讨论(0)
  • 2020-12-10 16:10

    Quote_Month (Worksheet!$D:$D) contains a formula (=TEXT(Worksheet!$E:$E,"mmm-yy"))to convert a date/time number from another column into a text based month reference.

    You can use OR by adding + in Sumproduct. See this

    =SUMPRODUCT((Quote_Value)*(Salesman="JBloggs")*(Days_To_Close<=90)*((Quote_Month="Cond1")+(Quote_Month="Cond2")+(Quote_Month="Cond3")))

    ScreenShot

    enter image description here

    0 讨论(0)
  • 2020-12-10 16:20

    You can use DSUM, which will be more flexible. Like if you want to change the name of Salesman or the Quote Month, you need not change the formula, but only some criteria cells. Please see the link below for details...Even the criteria can be formula to copied from other sheets

    http://office.microsoft.com/en-us/excel-help/dsum-function-HP010342460.aspx?CTT=1

    0 讨论(0)
  • 2020-12-10 16:21

    You can use SUMIFS like this

    =SUM(SUMIFS(Quote_Value,Salesman,"JBloggs",Days_To_Close,"<=90",Quote_Month,{"Oct-13","Nov-13","Dec-13"}))

    The SUMIFS function will return an "array" of 3 values (one total each for "Oct-13", "Nov-13" and "Dec-13"), so you need SUM to sum that array and give you the final result.

    Be careful with this syntax, you can only have at most two criteria within the formula with "OR" conditions...and if there are two then in one you must separate the criteria with commas, in the other with semi-colons.

    If you need more you might use SUMPRODUCT with MATCH, e.g. in your case

    =SUMPRODUCT(Quote_Value,(Salesman="JBloggs")*(Days_To_Close<=90)*ISNUMBER(MATCH(Quote_Month,{"Oct-13","Nov-13","Dec-13"},0)))

    In that version you can add any number of "OR" criteria using ISNUMBER/MATCH

    0 讨论(0)
提交回复
热议问题