CountIf the year of 2022 is between two dates

Anonymous321

New Member
Joined
Oct 12, 2021
Messages
32
Office Version
  1. 365
Platform
  1. Windows
I'm wanting to create a formula that will count cells if between two dates is the year 2022

StartEndShould Count This
01/09/202108/09/2023Should Count This
01/04/202201/09/2023Should Count This
01/10/202104/02/2023Should Count This
01/01/202112/12/2021Shouldn't Count This

Any help will be appreciated. Thanks :)
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Try this

Book1
ABC
1StartEndShould Count This
21/9/20218/9/2023Yes
31/4/20221/9/2023Yes
41/10/20214/2/2023Yes
51/1/202112/12/2021No
Sheet1
Cell Formulas
RangeFormula
C2:C5C2=IF(AND(A2<=DATE(2022,12,31),B2>=DATE(2022,1,1)),"Yes","No")
 
Upvote 0
I'm wanting to create a formula that will count cells if between two dates is the year 2022

StartEndShould Count This
01/09/202108/09/2023Should Count This
01/04/202201/09/2023Should Count This
01/10/202104/02/2023Should Count This
01/01/202112/12/2021Shouldn't Count This

Any help will be appreciated. Thanks :)

What about:
Excel Formula:
=COUNTIFS(A2:A5,"<"&DATE(2023,1,1),B2:B5,">"&DATE(2022,12,31))

/Skovgaard
 
Upvote 0
Should row 4 here be counted or not?
Fluff.xlsm
ABC
1StartEndShould Count This
201/09/202108/09/2023
301/04/202201/09/2023
401/10/202104/02/2022??
501/01/202112/12/2021
Data
 
Upvote 0
Should row 4 here be counted or not?
Fluff.xlsm
ABC
1StartEndShould Count This
201/09/202108/09/2023
301/04/202201/09/2023
401/10/202104/02/2022??
501/01/202112/12/2021
Data
Apologies should have explained it better
But yes it should be counted
I guess imagine its an employees start date and end date, if the employee at any point works in 2022 then it should count them. So in the that example, the employee did work in 2022 and so the formula should count them
 
Upvote 0
Ok, how about
Excel Formula:
=COUNTIFS(A:A,"<"&DATE(2023,1,1),B:B,">="&DATE(2022,1,1))
 
Upvote 0
Solution
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,013
Messages
6,122,690
Members
449,092
Latest member
snoom82

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