SUM or COUNT?

Raiiden

New Member
Joined
Jun 26, 2008
Messages
11
I am trying to add up the number of rows on sheet one that meet two different criteria, and produce the result in sheet 2.

1) Column A contains "36" - this ranges from 1 to 52

2) Colum M contains "1" - this is always 1 or 0

My code:

=COUNT(AND(COUNTIF('2008 Schedule'!$A5:$A10000,"36"),COUNTIF('2008 Schedule'!$M5:$M10000,1)))

It just seems to return "1" all the time wheteher anything is added or not.

Any ideas please?

Thanks
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
I am trying to add up the number of rows on sheet one that meet two different criteria, and produce the result in sheet 2.

1) Column A contains "36" - this ranges from 1 to 52

2) Colum M contains "1" - this is always 1 or 0

My code:

=COUNT(AND(COUNTIF('2008 Schedule'!$A5:$A10000,"36"),COUNTIF('2008 Schedule'!$M5:$M10000,1)))

It just seems to return "1" all the time wheteher anything is added or not.

Any ideas please?

Thanks

Try...
Code:
=SUMPRODUCT(
    --('2008 Schedule'!$A5:$A10000=36),
    --('2008 Schedule'!$M5:$M10000=1))
 
Upvote 0

Raiiden

New Member
Joined
Jun 26, 2008
Messages
11
I tried that thanks but I just get a 0 with that code.

=SUMPRODUCT(('2008 Schedule'!$A5:$A10000=36),('2008 Schedule'!$M5:$M10000=1))
 
Upvote 0

Raiiden

New Member
Joined
Jun 26, 2008
Messages
11
Hehe, I thought they were line separators :p

It works now, thank you very much!
 
Upvote 0

Forum statistics

Threads
1,191,524
Messages
5,987,103
Members
440,079
Latest member
MarchePR

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top