SUBTOTAL Function Anomaly

wdgor

Board Regular
Joined
Jan 21, 2009
Messages
90
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet (Office 365 version) that has 3000 rows. Column D has currency numbers, i.e., with 2 decimal places. Column B has Parent Account names. I need to apply a filter in the Parent Accounts column and correctly count the non-zero values in column D, i.e., get a subtotal count. Here is my formula: ="Count: "&SUBTOTAL(102,D4:D3000)&CHAR(10)&" "&DOLLAR(SUBTOTAL(9,D4:D3000)). The interesting thing about the execution of this formula is that is gives the right value IF a filter is applied. If there is no filter, it gives a wrong number. Here is what I mean:

With no filter: (the count should be 140)

Count: 2997
$139,716,993.65

With a filter: (this is the right count based on the filtered Parent)

Count: 4
$3,422,629.27

I can't figure out why it is not counting properly when no filter is applied. Thre are either $ numbers in each row or "0" all the way to row 3000. Any help from the geniuses that watch this site would be appreciated. Thanks in advance.
 
Correct. That allowed it to count all the positive and negative numbers but not count the 0. Thank you for your original solution - I just played around with adding a small piece.
 
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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
Back
Top