PC Review


Reply
Thread Tools Rate Thread

Count cells with a date in them

 
 
Caroline
Guest
Posts: n/a
 
      24th Feb 2009
Hello,
I would like to count cells in a column that have dates in them -any date, I
do not want to count cells with text or anything that's not a date.
I'm trying to use a countif, but I don't know how to write the criteria of a
date.
Thank you,
Caroline
 
Reply With Quote
 
 
 
 
Bob Umlas
Guest
Posts: n/a
 
      24th Feb 2009
a date to excel is a serial number, FORMATTED as a date. You can try
something like this:
=SUMPRODUCT(N(YEAR(A1:A100)>=2001),N(YEAR(A1:A100)<=2010))
to count the number of values which fall between 2001 and 2010, but a value
of 39868, for example, will be counted, since that's the serial# for today.
HTH - Bob Umlas - Excel MVP

"Caroline" <(E-Mail Removed)> wrote in message
news:BD9AC6F8-737C-4590-B8CC-(E-Mail Removed)...
> Hello,
> I would like to count cells in a column that have dates in them -any date,
> I
> do not want to count cells with text or anything that's not a date.
> I'm trying to use a countif, but I don't know how to write the criteria of
> a
> date.
> Thank you,
> Caroline



 
Reply With Quote
 
Caroline
Guest
Posts: n/a
 
      24th Feb 2009
Bob, this formula returns a #value? but I used the serial number in my
countif and that works for me.
Thank you!

"Bob Umlas" wrote:

> a date to excel is a serial number, FORMATTED as a date. You can try
> something like this:
> =SUMPRODUCT(N(YEAR(A1:A100)>=2001),N(YEAR(A1:A100)<=2010))
> to count the number of values which fall between 2001 and 2010, but a value
> of 39868, for example, will be counted, since that's the serial# for today.
> HTH - Bob Umlas - Excel MVP
>
> "Caroline" <(E-Mail Removed)> wrote in message
> news:BD9AC6F8-737C-4590-B8CC-(E-Mail Removed)...
> > Hello,
> > I would like to count cells in a column that have dates in them -any date,
> > I
> > do not want to count cells with text or anything that's not a date.
> > I'm trying to use a countif, but I don't know how to write the criteria of
> > a
> > date.
> > Thank you,
> > Caroline

>
>
>

 
Reply With Quote
 
Shane Devenshire
Guest
Posts: n/a
 
      24th Feb 2009
Remember, as Bob was pointing out, no Excel spreadsheet function can tell if
a cell is a date or a number if that number is between 0 and 2,958,465 - the
date range supported by Excel.

If you column only has dates, blanks, or text, no numbers then

=COUNTIF(A1:A100,">=0")

You can write your own VBA function to do this:

Function CountDates(R As Range)
For Each cell In R
If IsDate(cell) Then
Total = Total + 1
End If
Next cell
CountDates = Total
End Function


--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Caroline" wrote:

> Bob, this formula returns a #value? but I used the serial number in my
> countif and that works for me.
> Thank you!
>
> "Bob Umlas" wrote:
>
> > a date to excel is a serial number, FORMATTED as a date. You can try
> > something like this:
> > =SUMPRODUCT(N(YEAR(A1:A100)>=2001),N(YEAR(A1:A100)<=2010))
> > to count the number of values which fall between 2001 and 2010, but a value
> > of 39868, for example, will be counted, since that's the serial# for today.
> > HTH - Bob Umlas - Excel MVP
> >
> > "Caroline" <(E-Mail Removed)> wrote in message
> > news:BD9AC6F8-737C-4590-B8CC-(E-Mail Removed)...
> > > Hello,
> > > I would like to count cells in a column that have dates in them -any date,
> > > I
> > > do not want to count cells with text or anything that's not a date.
> > > I'm trying to use a countif, but I don't know how to write the criteria of
> > > a
> > > date.
> > > Thank you,
> > > Caroline

> >
> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count number of cells with date <today's date =?Utf-8?B?Q2FjaG9kMQ==?= Microsoft Excel New Users 2 28th Jan 2006 02:37 AM
count the number of cells with a date <= today's date =?Utf-8?B?Q2FjaG9kMQ==?= Microsoft Excel New Users 3 27th Jan 2006 09:14 PM
Re: Count ONLY the cells that are entered with a date? Myrna Larson Microsoft Excel Worksheet Functions 1 5th Aug 2004 05:03 PM
Re: Count ONLY the cells that are entered with a date? hgrove Microsoft Excel Worksheet Functions 0 5th Aug 2004 04:55 PM
A calculation to count all cells ='D' where the offset cells in range have dates <= todays date AlanN Microsoft Excel Misc 2 29th Jan 2004 03:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:11 AM.