[英]Excel Sum If based on month of date range?
I have sheet with a list of users and their holidays taken like so: 我的工作表中列出了用户及其假期,如下所示:
Katie 1 01/01/2016
Dave 2 12/02/2016
Dave 2 12/12/2015
Katie 1 17/11/20165
Liam 1 05/01/2016
Marie 1 09/08/2015
Marie 5 23/09/2015
I am then using the following SUMIF formula on my other sheet to return the total number of holidays taken for each person 然后,我在另一张纸上使用以下SUMIF公式返回每个人度假的总数
=SUMIF(Data!A$1:A$1000,A13,Data!B$1:B$1000)
This gives me a result like so: 这给了我这样的结果:
Katie 2
Dave 4
Liam 1
Marie 6
However, now I want to turn my SUMIF into a SUMIFS which only returns the values for the month of January like so: 但是,现在我想将我的SUMIF转换为SUMIFS,它仅返回一月份的值,如下所示:
Katie 1
Liam 1
I know I can get the month of the date by using =TEXT('Cell Ref',"mmmm")
but I'm not sure how I would combine this into an SUMIFS statement. 我知道我可以通过使用=TEXT('Cell Ref',"mmmm")
获得日期的月份,但是我不确定如何将其组合成SUMIFS语句。
Can someone please show me how I can do this? 有人可以告诉我我该怎么做吗?
Thanks in advance 提前致谢
You would need to use an Array Formula: 您将需要使用数组公式:
=SUM(IF((Data!A$1:A$1000=A13)*(Month(Data!C$1:C$1000) = 1),Data!B$1:B$1000))
Since it is an Array formula it needs to be confirmed with Ctrl-Shift-Enter when leaving edit mode. 由于它是一个数组公式,因此在退出编辑模式时需要使用Ctrl-Shift-Enter进行确认。 Then copied down. 然后复制下来。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.