axel67
Technical User
- Jan 2, 2007
- 21
Hi all,
Here is a real challenge (which I can't cope)....
I have the folowing table in Excel and I would like to report on combined criteria i.e. via DSUM or SUMPRODUCT:
A B C
1 Product Staff Sales
2 P1 S2 10
3 P2 S3 5
4 P1 S1 15
5 P3 S1 20
6 P4 S3 5
7 P3 S2 10
8 P1 S3 15
For Example I would like to know sales where prodcut group = "Luxury" (product P1 & P4) AND the sales team = "North" (Staff S2 and S3).
This is so far "usual" and "old" stuff, but here is the challange:
So rather than creating multiple condition lines in my DSum or Sumproduct which queries each individual condition, I would like to use the DSum or Sumproduct function in VBA and make a check if the line item is part of a group.
I had the following thoughts:
1.) create a kind of "Where Product IN ('P1','P4) and Where Staff IN ('S2', 'S3')" statement like:
SUMPRODUCT((A2:A8=F2:F3),(B2:B8=G2:G3),(C2:C8))
in cells "F" and "G" I would have the items to compare to.
2.) combine i.e. all the products of my product group to a string like "P1/P4" and the use the SEARCH function within the Sumproduct criteria, like =SumProduct((A2:A8=SEARCH(A2:A8,"P1/P4",1),(C2:C8)) but well the "dammed thing" does not inderstand that...
The reason why I am trying to do the above is that I can have many (100+) criteia that I would like to match within one dimension. For example I have 5000 different prodcut codes and I want to match sales to those that correspond to product group "Luxury" which contains 650 product codes.
Above did not get me anywhere.....If someone has an idea, it would be welcome. Or if someone could point me to a source where i can find information about using SQL on an Excel range within VBA.
I think a solution to this would be appreciated by many people, as it would make analysis so much easier.
Thanks for any hints,
Axel
Here is a real challenge (which I can't cope)....
I have the folowing table in Excel and I would like to report on combined criteria i.e. via DSUM or SUMPRODUCT:
A B C
1 Product Staff Sales
2 P1 S2 10
3 P2 S3 5
4 P1 S1 15
5 P3 S1 20
6 P4 S3 5
7 P3 S2 10
8 P1 S3 15
For Example I would like to know sales where prodcut group = "Luxury" (product P1 & P4) AND the sales team = "North" (Staff S2 and S3).
This is so far "usual" and "old" stuff, but here is the challange:
So rather than creating multiple condition lines in my DSum or Sumproduct which queries each individual condition, I would like to use the DSum or Sumproduct function in VBA and make a check if the line item is part of a group.
I had the following thoughts:
1.) create a kind of "Where Product IN ('P1','P4) and Where Staff IN ('S2', 'S3')" statement like:
SUMPRODUCT((A2:A8=F2:F3),(B2:B8=G2:G3),(C2:C8))
in cells "F" and "G" I would have the items to compare to.
2.) combine i.e. all the products of my product group to a string like "P1/P4" and the use the SEARCH function within the Sumproduct criteria, like =SumProduct((A2:A8=SEARCH(A2:A8,"P1/P4",1),(C2:C8)) but well the "dammed thing" does not inderstand that...
The reason why I am trying to do the above is that I can have many (100+) criteia that I would like to match within one dimension. For example I have 5000 different prodcut codes and I want to match sales to those that correspond to product group "Luxury" which contains 650 product codes.
Above did not get me anywhere.....If someone has an idea, it would be welcome. Or if someone could point me to a source where i can find information about using SQL on an Excel range within VBA.
I think a solution to this would be appreciated by many people, as it would make analysis so much easier.
Thanks for any hints,
Axel