A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Using COUNTIF with MONTH in formula



 
 
Thread Tools Display Modes
  #1  
Old June 13th, 2004, 11:05 PM
Kevin
external usenet poster
 
Posts: n/a
Default Using COUNTIF with MONTH in formula

Hello,

I have a number of formulas where I use the COUNTIF() formula to
count the number of occurences of a particular item in a range.
Now I would like to use in it conjunction with the MONTH() formula
and a list of dates to count the number of dates that occur in
a particular month.

For example, range A1:A100 contains dates and I want to know how
many of the dates occur in June. Given that MONTH returns numbers
1-12, I've been trying something like this:

COUNTIF(MONTH(A1:A100),6)

but I can't get it to work. I've tried using the CNTL-SHIFT-ENTER
to get this to work as an array formula, but no luck.

Any help would be appreciated.

Thanks,
Kevin
(take the "_" out of return email address)

  #2  
Old June 13th, 2004, 11:17 PM
Peo Sjoblom
external usenet poster
 
Posts: n/a
Default Using COUNTIF with MONTH in formula

Try

=SUMPRODUCT(--(MONTH(A1:A100)=6))

--


No private emails please, for everyone's
benefit keep the discussion in the newsgroup.

Regards,

Peo Sjoblom

"Kevin" wrote in message
...
Hello,

I have a number of formulas where I use the COUNTIF() formula to
count the number of occurences of a particular item in a range.
Now I would like to use in it conjunction with the MONTH() formula
and a list of dates to count the number of dates that occur in
a particular month.

For example, range A1:A100 contains dates and I want to know how
many of the dates occur in June. Given that MONTH returns numbers
1-12, I've been trying something like this:

COUNTIF(MONTH(A1:A100),6)

but I can't get it to work. I've tried using the CNTL-SHIFT-ENTER
to get this to work as an array formula, but no luck.

Any help would be appreciated.

Thanks,
Kevin
(take the "_" out of return email address)



  #3  
Old June 13th, 2004, 11:22 PM
Domenic
external usenet poster
 
Posts: n/a
Default Using COUNTIF with MONTH in formula

Hi Kevin,

Using COUNTIF, try,

=COUNTIF(A1:A10,"="&DATE(2004,6,1))-COUNTIF(A1:A10,""&DATE(2004,6,30))

Using SUMPRODUCT, try

=SUMPRODUCT(--(MONTH(A1:A10)=6),--(YEAR(A1:A10)=2004))

Hope this helps!

In article ,
Kevin wrote:

Hello,

I have a number of formulas where I use the COUNTIF() formula to
count the number of occurences of a particular item in a range.
Now I would like to use in it conjunction with the MONTH() formula
and a list of dates to count the number of dates that occur in
a particular month.

For example, range A1:A100 contains dates and I want to know how
many of the dates occur in June. Given that MONTH returns numbers
1-12, I've been trying something like this:

COUNTIF(MONTH(A1:A100),6)

but I can't get it to work. I've tried using the CNTL-SHIFT-ENTER
to get this to work as an array formula, but no luck.

Any help would be appreciated.

Thanks,
Kevin
(take the "_" out of return email address)

  #4  
Old June 13th, 2004, 11:33 PM
NickMinUK
external usenet poster
 
Posts: n/a
Default Using COUNTIF with MONTH in formula

Could insert column, use Month() in new column, then use countif on new
column with result in original column so you can hide new column. Not
fancy, but it works. See attached

Attachment filename: count months.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=580268
---
Message posted from http://www.ExcelForum.com/

  #5  
Old June 15th, 2004, 05:31 AM
Kevin
external usenet poster
 
Posts: n/a
Default Using COUNTIF with MONTH in formula

Thanks, that does exactly what I need.

The response by Peo,
=SUMPRODUCT(--(MONTH(A1:A100)=6))
mostly works, but I also have blank cells and the MONTH()
formula on a blank cell results in 1 which counts toward
the January total.

Your response has the added benefit of being able to
specify the year.

Thanks again.

Kevin

Domenic wrote:

Hi Kevin,

Using COUNTIF, try,

=COUNTIF(A1:A10,"="&DATE(2004,6,1))-COUNTIF(A1:A10,""&DATE(2004,6,30))

Using SUMPRODUCT, try

=SUMPRODUCT(--(MONTH(A1:A10)=6),--(YEAR(A1:A10)=2004))

Hope this helps!

In article ,
Kevin wrote:


Hello,

I have a number of formulas where I use the COUNTIF() formula to
count the number of occurences of a particular item in a range.
Now I would like to use in it conjunction with the MONTH() formula
and a list of dates to count the number of dates that occur in
a particular month.

For example, range A1:A100 contains dates and I want to know how
many of the dates occur in June. Given that MONTH returns numbers
1-12, I've been trying something like this:

COUNTIF(MONTH(A1:A100),6)

but I can't get it to work. I've tried using the CNTL-SHIFT-ENTER
to get this to work as an array formula, but no luck.

Any help would be appreciated.

Thanks,
Kevin
(take the "_" out of return email address)


  #6  
Old June 15th, 2004, 10:45 AM
sokevin
external usenet poster
 
Posts: n/a
Default Using COUNTIF with MONTH in formula

what is the syntax of sumproduct??

i do shift f3 but there is no sumproduct listed

thanks


---
Message posted from http://www.ExcelForum.com/

  #7  
Old June 15th, 2004, 10:53 AM
Norman Harker
external usenet poster
 
Posts: n/a
Default Using COUNTIF with MONTH in formula

Hi Sokevin!

SUMPRODUCT is under the Math function category:

=SUMPRODUCT(array1,array2,array3, ...)

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia

"sokevin " wrote in message
...
what is the syntax of sumproduct??

i do shift f3 but there is no sumproduct listed

thanks


---
Message posted from
http://www.ExcelForum.com/



 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:20 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.