I'm looking for a formula to run a COUNTIF (or similar) on a range of cells, and where the contained value is a date, to increment the counter – essentially something like:
=COUNTIF(range, if_date())
What I haven't been able to find is a logical test for the if_date() part of the question. Is there a way to test a cell to check whether its content is a date?
Best Answer
This is difficult with worksheet functions because dates in excel are simply formatted numbers - only
CELL
function lets you investigate the format of a cell (and you can't apply that to a range, so a helper column would be required).......or, if you only have dates and blanks.....or dates and text then it would be sufficient to useCOUNT
function, i.e.=COUNT(range)
That counts numbers so it won't be adequate if you want to distinguish dates from numbers. If you do then the number range could be utilised, e.g. if you have numbers in a range and dates but the numbers will all be lower than 10,000 and the dates will all be relatively recent then you could use this version to exclude the numbers
=COUNTIF(range,">10000")