#1   Report Post  
Judy
 
Posts: n/a
Default IF STATEMEMNTS

I once knew this... how can I nest a COUNTIF statement within an IF
statement? As in, If A:A = 9/1/2005 count B:B if = "A"

(I'm trying to count the number of As, Bc, Cs, etc based on a large
worksheet by months.

Thanks!
  #2   Report Post  
David Billigmeier
 
Posts: n/a
Default

Assume your dates are in the range A1:A5 and column B range is from B1:B5,
this formula will work:

=SUMPRODUCT(--(MONTH(A1:A5)=9),--(B1:B5="A"))

Hope that helps,
--
Regards,

David Billigmeier



"Judy" wrote:

I once knew this... how can I nest a COUNTIF statement within an IF
statement? As in, If A:A = 9/1/2005 count B:B if = "A"

(I'm trying to count the number of As, Bc, Cs, etc based on a large
worksheet by months.

Thanks!

  #3   Report Post  
JE McGimpsey
 
Posts: n/a
Default

One way:

=SUMPRODUCT(--(A1:A1000=DATE(2005,9,1)),--(B1:B1000="A"))

Or if months:

=SUMPRODUCT(--(MONTH(A1:A1000)=9),(B1:B1000="A"))

In article ,
"Judy" wrote:

I once knew this... how can I nest a COUNTIF statement within an IF
statement? As in, If A:A = 9/1/2005 count B:B if = "A"

(I'm trying to count the number of As, Bc, Cs, etc based on a large
worksheet by months.

Thanks!

  #4   Report Post  
Judy
 
Posts: n/a
Default

thanks to you both. This works on the same worksheet, but not a different
worksheet I'm using for a summary... why would that be?

"JE McGimpsey" wrote:

One way:

=SUMPRODUCT(--(A1:A1000=DATE(2005,9,1)),--(B1:B1000="A"))

Or if months:

=SUMPRODUCT(--(MONTH(A1:A1000)=9),(B1:B1000="A"))

In article ,
"Judy" wrote:

I once knew this... how can I nest a COUNTIF statement within an IF
statement? As in, If A:A = 9/1/2005 count B:B if = "A"

(I'm trying to count the number of As, Bc, Cs, etc based on a large
worksheet by months.

Thanks!


  #5   Report Post  
JE McGimpsey
 
Posts: n/a
Default

Probably because the changes you made to the formula were incorrect.

What do you mean when you say it didn't work? Did you get an error? an
incorrect result? a crash? no result?


In article ,
"Judy" wrote:

thanks to you both. This works on the same worksheet, but not a different
worksheet I'm using for a summary... why would that be?



  #6   Report Post  
Judy
 
Posts: n/a
Default

I changed it as follows:

Your example:
=SUMPRODUCT(--(MONTH(A1:A1000)=9),(B1:B1000="A"))

=SUMPRODUCT(--(MONTH('2005'!A:A)=9),--('2005'!J:J="A"))
I get #NUM! with this one.

=SUMPRODUCT(--(MONTH('2005'!A1:A2000)=9),--('2005'!J1:J2000="A"))
I get #VALUE! with this one

2005 is the name of the worksheet with the data. Thanks for your help.


"JE McGimpsey" wrote:

Probably because the changes you made to the formula were incorrect.

What do you mean when you say it didn't work? Did you get an error? an
incorrect result? a crash? no result?


In article ,
"Judy" wrote:

thanks to you both. This works on the same worksheet, but not a different
worksheet I'm using for a summary... why would that be?


  #7   Report Post  
JE McGimpsey
 
Posts: n/a
Default

Your #NUM! error comes from the fact that you can't use entire columns
(or rows) in array formulae - and SUMPRODUCT is an array formula even if
you don't need to use Control-Shift-Enter.

The #VALUE! error works for me. Check to see that you don't have a cell
with #VALUE! in A1:A2000 or J1:J2000.



In article ,
"Judy" wrote:

I changed it as follows:

Your example:
=SUMPRODUCT(--(MONTH(A1:A1000)=9),(B1:B1000="A"))

=SUMPRODUCT(--(MONTH('2005'!A:A)=9),--('2005'!J:J="A"))
I get #NUM! with this one.

=SUMPRODUCT(--(MONTH('2005'!A1:A2000)=9),--('2005'!J1:J2000="A"))
I get #VALUE! with this one

2005 is the name of the worksheet with the data. Thanks for your help.


"JE McGimpsey" wrote:

Probably because the changes you made to the formula were incorrect.

What do you mean when you say it didn't work? Did you get an error? an
incorrect result? a crash? no result?


In article ,
"Judy" wrote:

thanks to you both. This works on the same worksheet, but not a
different
worksheet I'm using for a summary... why would that be?


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



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