subtotal() behavior

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
I want to count number of cells based on color. So I used conditional formatting to highlight cells which has value >70. The under column A I typed =subtotal (2,B2:B25) then I used to auto fill to copy that formula to column C, D, and E.
Now all subtotal() returned 24 (so far so good). Then I used Filter to filter column A based on cell color (Red). All subtotal() functions returned the same number 7. Which is only right for column B not the other. The unfilter and tried to filter column C this time and same story, all subtotals returned 4 which is only correct for column C.
Why subtotal behave like that? Thank you
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Formulas do not see cell colors. You can use countif or countifs to count the cells.
Code:
=COUNTIF(B2:B10,">70")
 
Upvote 0

Forum statistics

Threads
1,216,189
Messages
6,129,408
Members
449,509
Latest member
ajbooisen

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