Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
tom tom is offline
external usenet poster
 
Posts: 570
Default count the occurrences of a month in a date&time cell

Hi,

I'm trying to count the occurrences of any given month in a rage where the
cells are in a date&time format. (11/02/2008 11:22:53)

For example in the range A1:A30 I want to count the number of times the
month of February occurs.

I've tried a count(if(mid formula but my brain melted after the 10 attempt.

Any help would be greatly appreciated.

Thanks,
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default count the occurrences of a month in a date&time cell

For example in the range A1:A30 I want to count the number of times the
month of February occurs.


Try: =SUMPRODUCT((MONTH(A1:A30)=2)*(A1:A30<""))
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Tom" wrote:
I'm trying to count the occurrences of any given month in a rage where the
cells are in a date&time format. (11/02/2008 11:22:53)

For example in the range A1:A30 I want to count the number of times the
month of February occurs.

I've tried a count(if(mid formula but my brain melted after the 10 attempt.

Any help would be greatly appreciated.

Thanks,

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,480
Default count the occurrences of a month in a date&time cell

Hi Tom
One way
=SUMPRODUCT(--(TEXT(A1:A30,"yymmm")="08Feb"))

--
Regards
Roger Govier

"Tom" wrote in message
...
Hi,

I'm trying to count the occurrences of any given month in a rage where the
cells are in a date&time format. (11/02/2008 11:22:53)

For example in the range A1:A30 I want to count the number of times the
month of February occurs.

I've tried a count(if(mid formula but my brain melted after the 10
attempt.

Any help would be greatly appreciated.

Thanks,


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default count the occurrences of a month in a date&time cell

Do you need the <"" test? Would you satisfy the MONTH=2 test if column A
had =""?
--
David Biddulph

"Max" wrote in message
...
For example in the range A1:A30 I want to count the number of times the
month of February occurs.


Try: =SUMPRODUCT((MONTH(A1:A30)=2)*(A1:A30<""))
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Tom" wrote:
I'm trying to count the occurrences of any given month in a rage where
the
cells are in a date&time format. (11/02/2008 11:22:53)

For example in the range A1:A30 I want to count the number of times the
month of February occurs.

I've tried a count(if(mid formula but my brain melted after the 10
attempt.

Any help would be greatly appreciated.

Thanks,



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,480
Default count the occurrences of a month in a date&time cell

Hi David
I would think Max was generalising, in case the OP tried it for January as
well, as all blank cells would then be counted (00 Jan 1900)
I tried to eliminate that with my posting by including the year (I agree 08
would pick up 1908, but didn't think that likely for the OP).
Of course it would have been better if I had used
text(date,"yyyymmm")="2008Feb"
--
Regards
Roger Govier

"David Biddulph" <groups [at] biddulph.org.uk wrote in message
...
Do you need the <"" test? Would you satisfy the MONTH=2 test if column A
had =""?
--
David Biddulph

"Max" wrote in message
...
For example in the range A1:A30 I want to count the number of times the
month of February occurs.


Try: =SUMPRODUCT((MONTH(A1:A30)=2)*(A1:A30<""))
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Tom" wrote:
I'm trying to count the occurrences of any given month in a rage where
the
cells are in a date&time format. (11/02/2008 11:22:53)

For example in the range A1:A30 I want to count the number of times the
month of February occurs.

I've tried a count(if(mid formula but my brain melted after the 10
attempt.

Any help would be greatly appreciated.

Thanks,





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default count the occurrences of a month in a date&time cell

Yes, I was generalizing the expression for the OP, as per Roger's line:
I would think Max was generalising, in case the OP tried it for January as
well, as all blank cells would then be counted (00 Jan 1900)


But perhaps I should have explained it in the response itself for
completeness. Roger, thanks for that favour!
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
tom tom is offline
external usenet poster
 
Posts: 570
Default count the occurrences of a month in a date&time cell

Hi,

Thank you all.

Both solutions worked without a hitch but I'll be going with Roger's as it
gives the option of including a year as well as a moth.

Thank you,
Tom

"Roger Govier" wrote:

Hi Tom
One way
=SUMPRODUCT(--(TEXT(A1:A30,"yymmm")="08Feb"))

--
Regards
Roger Govier

"Tom" wrote in message
...
Hi,

I'm trying to count the occurrences of any given month in a rage where the
cells are in a date&time format. (11/02/2008 11:22:53)

For example in the range A1:A30 I want to count the number of times the
month of February occurs.

I've tried a count(if(mid formula but my brain melted after the 10
attempt.

Any help would be greatly appreciated.

Thanks,



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
Count occurrences of text within a cell Stan Sitek Excel Worksheet Functions 5 August 20th 08 10:24 PM
Counting occurrences of specific month bpoland58 Excel Discussion (Misc queries) 2 December 13th 07 05:46 PM
Extra month shown in date count IyvH Excel Worksheet Functions 2 December 4th 07 04:29 AM
Count how many persons in a month using a date mash Excel Worksheet Functions 2 April 4th 07 03:09 AM
how to count the nr of occurrences of a text string in a cell rang eagerbuyer Excel Worksheet Functions 1 November 4th 04 12:27 PM


All times are GMT +1. The time now is 04:40 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"