I have a ODBC query in Excel that I have attached slicers to in order to filter the data.
Those slicers are on the main page along with a series of formulas to analyze the data.
i.e. Table on Sheet 2 contains rows with a unique ID, state, county, zip, and other fields.
I have Slicers on Sheet 1 that filter the data in the Table in Sheet 2. On sheet one I also have a series of calculations in Sheet 1 such as:
=count(Sheet2!A:A)
=countif(Sheet2!B:B,1)/count(Sheet2!A:A)
So with no slicers selected, the formulas should count the total in Sheet2!A:A
, however when I select a value from the slicer to filter the table, it shows the same calculated value essentially ignoring the filters.
Figured it out:
Need to use the SUBTOTAL
function then the corresponding function # (i.e. 2 is count, 9 is sum etc.)
so the calculation looks like this
=count(Sheet2!A:A)
becomes =subtotal(2,Sheet2!A:A)