I need a VBA function that will perform the following:
Find all unique values on Sheet 1, column “A”, copy text from column B and column C, sum column D through G (all sums must be within the unique value).
Example:
# A B C D E F G
-- ------- ---- - - ---- - ---
1. 1110021 Job1 A 0 3000 0 200
2. 1110021 Job1 A 5 3000 0 200
3. 1110021 Job1 A 0 6000 0 200
4. 1110021 Job1 A 0 3000 2 200
5. 2254152 Job2 B 4 3000 1 400
6. 2254152 Job2 B 5 1000 1 400
7. 2254152 Job2 B 1 1000 0 400
8. 2254152 Job2 B 0 1000 0 400
9. 2254152 Job2 B 0 3000 1 400
10. 3054153 Job3 C 7 1000 4 300
11. 3054153 Job3 C 2 3000 4 600
12. 3054153 Job3 C 0 1000 4 400
The result would look something like this (on Sheet 2):
1. 1110021 Job1 A 5 15000 2 800
2. 2254152 Job2 B 10 9000 3 2000
3. 3054153 Job3 C 9 5000 12 1300
Can anyone help with this?
A pivot table, as @assylias suggested would make this incredibly easy. Goto the
Datamenu option, and selectPivotTable and PivotChart Report...(In Excel 2003)Also, using the
Subtotals...functionality (also under theDatamenu in 2003) should work here as well, if you data is simple enough.