Hello. I am currently working on a report that has a large amount of data on a summary sheet which includes 1200+ individuals and their sales results in 12 different categories. I have a front end summary sheet that makes it prettier and more user friendly with four different combo boxes with different criteria. The code was cumbersome, but it got the job done. Now they have asked me to add a fifth combo box so they can filter by an additional criteria. I used code to convert named ranges to a variable depending on what category the person fell into, but I need to do a count of how many individuals meet multiple criteria.
If I only have one criteria, or if for example, somebody chooses Type A from the second combo box, FL from the third combo box, and a specific name from the first combo box, the countif formula I'm using works properly. Where I'm running into issues is when somebody wants to view the total for Types A and B, from all states, for all people.
For the code below, PersonRange, TypeRange,StateRange are all defined ranges.
Person, AgentType, and AgState are variables dependent on what is selected from combo boxes 1, 2 , and 3. The variables are fine if they select specific criteria, but if I try to define Person as "<>" so that it pulls back all people that are Type A and live in FL, Person returns as FALSE instead of "<>". Is it possible to count people where, for example, Type A is selected in All states?
(The code is not in the attached file, it is just provided for an example of what my report looks like.) Sample Combobox Sheet.xlsx
![]()
AgentCount = Application.WorksheetFunction.CountIfs(PersonRange, Person, TypeRange, AgentType, StateRange, AgState)
Bookmarks