Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 791
Default Formula for counting events

Is there a simple formula for counting events per date?
E.g. I have a list of dates of birth of 200 kids born in 2005 and I would
like to create a table with the numbers of kids born in Jan 2005, Feb 2005,
March 2005 etc.
Please help me with a formula.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,480
Default Formula for counting events

Hi Michael

Assuming the dates are in column A
=SUMPRODUCT(--(MONTH($A$1:$A$200=1))
will give the total for January

If you entered Jan through Dec in say E1:E12, you could put in F1
=SUMPRODUCT(--(MONTH($A$1:$A$200=ROW(F1)))
and copy down.

As you copy down, Row() will increase from 1 through 12 and give the results
for each Month.

If you had data straddling a year, say you wanted from Apr 2004 to Mar 2005,
then enter in E1:E12 proper dates for the month e.g. 01 Apr 2004, etc. but
format the cells as FormatCellsNumberCustom mmm
Then use the formula in F1
=SUMPRODUCT(--(TEXT($A$1:$A$200,"yymm"=TEXT(E1,"yymm"))
and copy down
--
Regards
Roger Govier

"Michael" wrote in message
...
Is there a simple formula for counting events per date?
E.g. I have a list of dates of birth of 200 kids born in 2005 and I would
like to create a table with the numbers of kids born in Jan 2005, Feb
2005,
March 2005 etc.
Please help me with a formula.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Formula for counting events

Michael,

Suppose your list of dates are in the range A1:A100. In cells B1:B12 enter
the numbers 1 through 12, indicating months. Then, in C1, enter

=SUM(IF($A$1:$A$100=0,0,--(MONTH($A$1:$A$100)=B1)))


and press CTRL SHIFT ENTER rather than just ENTER. Copy this formula down
from C1 through C12. The formula will return the number of dates in A1:A100
that are in the month listed in column B.

Note that this is an array formula, so you must press CTRL SHIFT ENTER
rather than just ENTER when you first enter the formula and whenever you
edit it later. If you do not do this, the result will be incorrect. If you
do this properly, Excel will display the formula enclosed in curly braces
{ }. See http://www.cpearson.com/Excel/ArrayFormulas.aspx for much more
information about array formulas.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)






"Michael" wrote in message
...
Is there a simple formula for counting events per date?
E.g. I have a list of dates of birth of 200 kids born in 2005 and I would
like to create a table with the numbers of kids born in Jan 2005, Feb
2005,
March 2005 etc.
Please help me with a formula.


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 791
Default Formula for counting events

Dear Chip,
Thank you for your reply. I did exactly as you said and copied your formula
to C1. It did not work until I replaced 0,0, with 0;0; and I do not
understand why - does it depend on Excel version? I have 2003.
Could you also advice me how to do the count if I have data for more than
one year - in my case it is from May 2005 to February 2006 and then after a
pause from September 2006 to May 2007.
Kind regards,
Michael
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 791
Default Formula for counting events

Thank you Roger,
Unfortunately I get result 200 every time for your 1st and 2nd formula.
Kind regards,
Michael


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,480
Default Formula for counting events

Hi Michael

Sorry, typos on my part
They should have read

=SUMPRODUCT(--(MONTH($A$1:$A$200)=1))
and
=SUMPRODUCT(--(MONTH($A$1:$A$200)=ROW(F1)))

Also, it depends upon the dates being Excel dates and not text
representations of the date.
In another cell, type =ISNUMBER(A1) It should return TRUE if it is an Excel
date.

If you have Text values in column A, mark the whole column then
DataText to columnsNextNextDateDMYFinish and that will convert them to
true numeric Excel dates.

--
Regards
Roger Govier

"Michael" wrote in message
...
Thank you Roger,
Unfortunately I get result 200 every time for your 1st and 2nd formula.
Kind regards,
Michael


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need formula for time between two events k1ngr Excel Worksheet Functions 5 February 27th 08 05:37 AM
counting the number of events in a year Mytmini Excel Worksheet Functions 2 November 5th 07 12:55 AM
Counting events since last occurences Tony the Bajan Excel Worksheet Functions 0 November 8th 06 05:59 PM
Counting the events osj Excel Worksheet Functions 3 March 11th 05 10:59 PM
Allowing events/macros during formula mode? shorowit Excel Discussion (Misc queries) 1 February 9th 05 05:32 PM


All times are GMT +1. The time now is 03:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"