Question : Excel 2007 Subtotal Function

I am about to pull my hair out: I have just started using excel 2007 after years of 2000 and some limited 2003.  I have a database that I am filtering and have used my tried and true method of counting the records for each filter operation with the subtotal function and a column of "1"'s.

It was not working as I anticipated, so I used help for Subtotal.  I found that Subtotal can include the hidden records in the total (9) or exclude  the hidden records in the total (109).

The database unfortunately includes duplicates when there should not be any and I am attempting to clean up.  I was using the Advanced Filter to show unique data, marking those, and filtering to locate the exceptions (duplicates).  I found I could be more efficient using the conditional formating and filtering by color.

HOWEVER, I am puzzled by something I observed while attempting my first methodology.  I had two columns of one's (2 fields in each record).  In one column I entered the formula: SUBTOTAL(109,M1:M821).  In the other I entered SUBTOTAL(9,M1:M821).  According to Excel Help, 109 should ignore (exclude?) the hidden values in the column; and 9 should included all values, hidden or not.  (I believe it used to be (Excel 2000) that "9" summed the visible values).

Although I have used Excel 2003 before, it could be the case that I did not use this functionality during that limited time to notice the change in "9" results.

Can someone shed some light on why both formulas would yield same results?

Additional observations: thinking I might have a recalc problem for some reason, I went into each SUBTOTAL cell, hit F2 to edit and enter.  Both formulas responsed the same to the edit and return sequence.  Each returned  the total of the visible records - only after F2 and returning for each individual cell!

Search of archives did not shed any light.

Any ideas?

Thanks.

Answer : Excel 2007 Subtotal Function

I think you misunderstand the current usage of the SUBTOTAL function. When it talks about hidden cells it means hidden, not filtered. It will ignore filtered values for both 9 and 109 but with 109 if there are some additional hidden rows in there, for example, they will also get ignored...but 9 will still include them.

To get what I THINK you are looking for:

IF you are using filtering

SUM(range) to get the total count regardless of filtering or hiding
SUBTOTAL(9,range) to get the filtered count

IF you are hiding rows programmatically (for example)

SUBTOTAL(9,range) to get the full count
SUBTOTAL(109,range) to get the full count minus any hidden rows

Alistair

Random Solutions  
 
programming4us programming4us