Counting a number of text entries where the text is a filter

phboujon

New Member
Joined
Oct 28, 2002
Messages
1
Hi,

I have the following (huge) table:
PublisherName / ProductName / ComputerName

When I do an autofilter, I can select a ProductName (the criteria of the filter) and see all the ComputerName on which it has been installed.

What I would like is a macro which count how many ComputerName is there (How many row is there for a given ProductName as criteria).

I dont know much about Excel programming, that's why I am looking for help.

Thanks
Philippe
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

SamS

Well-known Member
Joined
Feb 17, 2002
Messages
542
On 2002-10-29 19:02, phboujon wrote:
Hi,

I have the following (huge) table:
PublisherName / ProductName / ComputerName

When I do an autofilter, I can select a ProductName (the criteria of the filter) and see all the ComputerName on which it has been installed.

What I would like is a macro which count how many ComputerName is there (How many row is there for a given ProductName as criteria).

I dont know much about Excel programming, that's why I am looking for help.

Thanks
Philippe

For a quick work around - if you have your Status Bar showing (Tools>Options>View tick Status Bar)- right click on the Status bar and select Count, then select the first line of your filtered data hold the Shift key and press End. The count will show on your Status Bar.
 

BigC

Well-known Member
Joined
Aug 4, 2002
Messages
851
Philippe
I often need to know the sum or count of the items returned by filtering, so what I do is this:
In the row ABOVE the field names of my database (so that these values will always be visible) I use =SUBTOTAL(arg1,range) to return the value I want. This formula only looks at DISPLAYED cells, so cells hidden by filtering are ignored.
I also build a "fence" at the bottom of my database (enter "=" in the cells of the next blank row) and insert all new data rows above this fence. The bottom ref of Range is the fence so that it will always include my entire database.

For example, if your database is in A2:C200 (with field names PublisherName / ProductName / ComputerName in row 2, and a "fence" as row 200) I would enter =SUBTOTAL(3,C3:C200)in C1.
This will give you a count of the ComputerName items displayed after applying any filter (irrespective of the field on which the filter was applied). Use a "9" instead of a "3" will give you the SUM of the items in the SUBTOTAL range. See Excel Help for more on SUBTOTAL)


HTH
 

Forum statistics

Threads
1,143,640
Messages
5,719,986
Members
422,256
Latest member
downeybm

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
Top