简体   繁体   中英

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(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:

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.

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. Then copied down.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM