Locating specific dates in a column

datadummy

Active Member
Joined
Mar 16, 2017
Messages
313
Office Version
  1. 365
Platform
  1. Windows
I am trying to write a formula that will reference a column and give me a count of all cells that have the specified year in them. Example column H will various years worth of data in this format 1/01/2017 and I am attempting to get counts of each years total, so month and day are pretty much irrelevant.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Try this formula, which is an array formula so needs to be entered with CTRL-SHIFT-ENTER:
Code:
=SUM(IF(YEAR(H:H)=2017,1))
If entered correctly, it will show curly brackets in the formula bar after entry, i.e.
Code:
{=SUM(IF(YEAR(H:H)=2017,1))}
 
Upvote 0
Try:


Excel 2013/2016
ABCD
1DateYear2017
21/1/2017Count3
32/25/2017
412/13/2016
511/28/2016
66/25/2017
Sheet17
Cell Formulas
RangeFormula
D2=COUNTIFS(A:A,">="&DATE(D1,1,1),A:A,"<="&DATE(D1,12,31))
 
Upvote 0
I tried the equation and its returning #VALUE! . I entered it as you recommended and got the extra brackets to populate but something doesn't seem to be working. Could the fact that there are many blanks in the column through off the formula?
 
Upvote 0
I currently am running excel 2007, will this work in that version?
 
Upvote 0
Could the fact that there are many blanks in the column through off the formula?
When you say "blanks", do you mean empty cell, or spaces?
Any text entries might cause problems.
However, you can modify it and it should work.
Just change H:H to the actual range you want to check, i.e. H2:H100.
If we can get exclude any cells that have spaces or text in it, it should work.
 
Upvote 0
When you say "blanks", do you mean empty cell, or spaces?
Any text entries might cause problems.
However, you can modify it and it should work.
Just change H:H to the actual range you want to check, i.e. H2:H100.
If we can get exclude any cells that have spaces or text in it, it should work.

The blanks are empty cells.
 
Upvote 0
Did you try changing the range to just the cells you want to check.
Text entries (like Column Headings) will cause that error.
 
Upvote 0
Did you try changing the range to just the cells you want to check.
Text entries (like Column Headings) will cause that error.

I updated the formula with a cell range and it is still returning the error. Currently my formula looks like this {=SUM(IF(YEAR(H2:H5000)=2012,1))}.
 
Upvote 0
Are all the dates entered as dates (and not as Text that looks like dates)?
Are there any text entries anywhere between H2 and H5000?

If there are not, then if you enter these two formulas anywhere on your sheet:
{=SUM(IF(ISNUMBER(H2:H5000),1))}
=COUNTBLANK(H2:H5000)
they should add up to 4999.
If they do not, then you have some text entries somewhere in there.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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