View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
MIchael MIchael is offline
external usenet poster
 
Posts: 2
Default How to count items depending on attributes in VBA

Hello
I have a table
Each line is about a window and its attributes.
One of the attributes is the floor on which the window is installed and an other is the class (1-5) of the window
What I need to do is: I want to count the windows on each floor from floor 1-x and depending on its class.
So the table looks like that:


Window
Number floor class
1 1 1
2 1 1
3 2 3
4 2 3
5 2 2
.. . .
.. . .
.. . .

So the result should be :
2 Windows on floor 1 with class 1
2 Windows on floor 2 with class 3
1 Window on floor 2 with class 2
and so on...... for the other floors

in VBA

I tried the function dcount but did not succeed because the criteria should not be in the table
and I dont know how to loop it..
Dim winClass1 as long
winClass1 = Application.WorksheetFunction.DCountA(Range("A:F") , 2, Range("H1:J2"))

Thank you very much for any help!

MIchael