COUNTIF using structured reference and dates

PatRichard

New Member
Joined
Dec 29, 2018
Messages
16
Office Version
  1. 365
Platform
  1. Windows
Greetings - I didn't see this in a search, but maybe I'm not searching right. I have a table with a column of dates. Some of the dates are mm/dd/yyyy, and some are just mm/yyyy. I'm trying to count the number of cells in a column in which the year is a specific value. But I'm just coming up with 0. I'm using:
Excel Formula:
=COUNTIF((MyInventory[Born On]),1985)
but also tried replacing the year with a cell reference (I'm building a table that shows quantities by year).

What am I missing here?
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
How about
Excel Formula:
=SUMPRODUCT(--(year(MyInventory[Born On])=1985))
 
Upvote 0
Make sure that all the dates are real dates & not text.
 
Upvote 0
Greetings - I didn't see this in a search, but maybe I'm not searching right. I have a table with a column of dates. Some of the dates are mm/dd/yyyy, and some are just mm/yyyy. I'm trying to count the number of cells in a column in which the year is a specific value. But I'm just coming up with 0. I'm using:
Excel Formula:
=COUNTIF((MyInventory[Born On]),1985)
but also tried replacing the year with a cell reference (I'm building a table that shows quantities by year).

What am I missing here?
If you're not getting a valid return from something like COUNTIF (or COUNTIFS if you have a recent version of Excel - what OS and Excel Version can be added to your Profile), then those "dates" are not actually dates. If they were, regardless of their formatting (mm/dd/yyyy or mm/yyyy) they would represent an actual date, although in the second case you wouldn't know what the date is without either changing the format or using the DAY function. You should fix the data rather than find a work-around to bad data.
 
Upvote 0
Greetings - I didn't see this in a search, but maybe I'm not searching right. I have a table with a column of dates. Some of the dates are mm/dd/yyyy, and some are just mm/yyyy. I'm trying to count the number of cells in a column in which the year is a specific value. But I'm just coming up with 0. I'm using:
Excel Formula:
=COUNTIF((MyInventory[Born On]),1985)
but also tried replacing the year with a cell reference (I'm building a table that shows quantities by year).

What am I missing here?
Try this, maybe the year is formatted as text.

Excel Formula:
=COUNTIF((MyInventory[Born On]),"1985")
 
Upvote 0
How is that gong to work when the OP said
That doesn't determine whether or not they're dates. They could be actual numeric date values badly formatted. If not, they should be fixed.
 
Upvote 0
I am fully aware of that, see post#4
And your comment makes no sense in relation to what I said in reply to post#6
 
Upvote 0
Are you able to add this column to MyInventory, and then count that instead?

Excel Formula:
=YEAR([@[Born On]])
 
Upvote 0

Forum statistics

Threads
1,215,563
Messages
6,125,565
Members
449,237
Latest member
Chase S

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