COUNTIF partial date, using year

Enzo_Matrix

Board Regular
Joined
Jan 9, 2018
Messages
113
I've gone through a few of the pages that are asking similar countif questions regarding dates and I haven't found one that works for my circumstances yet. Any help would be appreciated.

Column B has my date ranges in format January 1, 2017 (this can be changed). I have data spanning 4 years and I want to count how many instances there are for the year 2015, 2016, 2017, 2018 without adding another column with just the year in it.

I have tried this and it has not worked
Code:
=COUNTIF(B:B,"*2017*")

please help
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
"Column B has date ranges"

Are these dates text or proper dates?

If they are proper dates then

=SUMPRODUCT(--(YEAR(B1:B1000)=2017))

If they are text then

=SUMPRODUCT(--(RIGHT(B1:B1000,4)+0=2017))

Copy and amend the formula for other years
 
Last edited:
Upvote 0
If these are actual dates (and not text) then:

Code:
=COUNTIFS(B:B,">="&DATE(2017,1,1),B:B,"<"&DATE(2018,1,1))

WBD
 
Upvote 0
Excel dates are stored internally as numbers and do not contain 2017. They are a count of days since 1900 (I think).
So if you search for 2017 it won't be found.
"*2017*" searches for text not numbers.

You can put YEAR() around a range in a SUMPRODUCT but you cant do this with a COUNTIF.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,361
Members
449,080
Latest member
Armadillos

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