Countifs formula with criteria comparing date with year

RockEd

Board Regular
Joined
Aug 13, 2021
Messages
80
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am trying to write a formula that counts for every time a person appears in a table whilst also checking whether they appear in the selected year.

First sheet ('enter data'):

Case numberPersonDate signed up
1Person A01/10/2021
2Person A01/08/2021
3Person A01/01/2022
4Person B01/10/2021

Second sheet: this is what I want it to look like:

Year (drop down)List of peopleCase count for year
2021Person A 2
Person B1

So the formula I have in column C in the second table is currently (that is wrong):

Excel Formula:
=IF(B2="",0,((COUNTIFS(IM_case,$B2,TM_ests_month_list,$A$2))))

Where IM_Case an offset formula that effectively tracks column A above; if you must know:

Excel Formula:
=OFFSET('Enter data'!$$2,0,0,COUNTA('Enter data'!$A:$A)-1,1)

and TM_ests_month_list is a similar offset formula that tracks column C in the first sheet:

Excel Formula:
=OFFSET('Enter data'!$C$2,0,0,COUNTA('Enter data'!$A:$A)-1,1)

However I know this is wrong because it is comparing the full dates of say 01/10/2021 against the date of 2021 (which I believe would default to 01/01/2021). I somehow need to insert a formula similar to this:
Excel Formula:
=IF(YEAR(A2)=YEAR(TM_ests_month_list),[value if true], [value if false])

But I can't get my head around how to do that! Can someone help please?
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Sheet2 C2:
Excel Formula:
=COUNTIFS('Sheet1'!$C:$C, 'Sheet2'!$A$2, 'Sheet1'!$B:$B, 'Sheet2'!$B2)
I didn't understand the rest, sorry.
 
Upvote 0
How about
Fluff.xlsm
ABCDEFG
1Case numberPersonDate signed up
21Person A01/10/20212021Person A2
32Person A01/08/2021Person B1
43Person A01/01/2022
54Person B01/10/2021
Update
Cell Formulas
RangeFormula
G2:G3G2=COUNT(FILTER($C$2:$C$1000,(YEAR($C$2:$C$1000)=$E$2)*($B$2:$B$1000=F2)))
 
Upvote 0
How about
Fluff.xlsm
ABCDEFG
1Case numberPersonDate signed up
21Person A01/10/20212021Person A2
32Person A01/08/2021Person B1
43Person A01/01/2022
54Person B01/10/2021
Update
Cell Formulas
RangeFormula
G2:G3G2=COUNT(FILTER($C$2:$C$1000,(YEAR($C$2:$C$1000)=$E$2)*($B$2:$B$1000=F2)))

Thank you, however that doesn't quite work for me because the year (in this case cell E2) is actually 01/01/2021 (with the formatting of the cell being custom category of YYYY).

If it is more hassle to change it then please say, and I will remove the date and just put in a 'general' number equal to the year; however I'd prefer to keep it as a proper date if at all possible..

thank you!!
 
Upvote 0
In that case you can use
Excel Formula:
=COUNT(FILTER($C$2:$C$1000,(YEAR($C$2:$C$1000)=year($E$2))*($B$2:$B$1000=F2)))
 
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top