Neophyte question about using Subtotal and CountIf in Excel

Posted by Andrew on Stack Overflow See other posts from Stack Overflow or by Andrew
Published on 2010-06-10T14:31:38Z Indexed on 2010/06/10 14:32 UTC
Read the original article Hit count: 470

Filed under:
|

Hi, I'm using Excel and having some problems with Countif and I don't understand how it works differently from SubTotal. I used the GUI to subtotal stuff and all the subtotals are right. Then I attempted to use the Countif to see how many requirements passed. That worked for the first subtotal only. It's easy to see why. When I look at the box for the subtotal, it says: =SUBTOTAL(3,C286:C292) When I look at my formula for passed requirements, I have: =IF(ISTEXT(A285),COUNTIF(C286:C338,"=Passed"),"") Notice that the last column is wrong. How did the Subtotal manage to keep this correct? I typed in the formula for passed requirements and dragged it down the page. Everything behaved as expected (even the bit about ISTEXT dutifully figured out which row was which), but it got the last row wrong.

Any ideas?

SRS Maintenance Count   7   44  
SRS Maintenance Passed              
SRS Maintenance Passed              
SRS Maintenance Passed              
SRS Maintenance Passed              
SRS Maintenance Passed              
SRS Maintenance Passed              
SRS Maintenance Passed              
SRS Reports Count   12  43  
SRS Reports Passed              
SRS Reports Passed              
SRS Reports Passed              
SRS Reports Passed              
SRS Reports Failed              
SRS Reports Passed              
SRS Reports Passed              
SRS Reports Failed              
SRS Reports Passed              
SRS Reports Passed              
SRS Reports Failed              

© Stack Overflow or respective owner

Neophyte question about using Subtotal and CountIf in Excel

Posted by Andrew on Super User See other posts from Super User or by Andrew
Published on 2010-06-10T14:31:38Z Indexed on 2010/06/10 16:33 UTC
Read the original article Hit count: 470

Filed under:

Hi, I'm using Excel and having some problems with Countif and I don't understand how it works differently from SubTotal. I used the GUI to subtotal stuff and all the subtotals are right. Then I attempted to use the Countif to see how many requirements passed. That worked for the first subtotal only. It's easy to see why. When I look at the box for the subtotal, it says:

=SUBTOTAL(3,C286:C292)

When I look at my formula for passed requirements, I have:

=IF(ISTEXT(A285),COUNTIF(C286:C338,"=Passed"),"")

Notice that the last column is wrong. How did the Subtotal manage to keep this correct? I typed in the formula for passed requirements and dragged it down the page. Everything behaved as expected (even the bit about ISTEXT dutifully figured out which row was which), but it got the last row wrong.

Any ideas?

SRS Maintenance Count   7   44  
SRS Maintenance Passed              
SRS Maintenance Passed              
SRS Maintenance Passed              
SRS Maintenance Passed              
SRS Maintenance Passed              
SRS Maintenance Passed              
SRS Maintenance Passed              
SRS Reports Count   12  43  
SRS Reports Passed              
SRS Reports Passed              
SRS Reports Passed              
SRS Reports Passed              
SRS Reports Failed              
SRS Reports Passed              
SRS Reports Passed              
SRS Reports Failed              
SRS Reports Passed              
SRS Reports Passed              
SRS Reports Failed              

© Super User or respective owner

Related posts about excel

Related posts about excel-vba