ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   A VB Code instead of a pivot & sobtotals (https://www.excelbanter.com/excel-programming/277289-vbulletin-code-instead-pivot-sobtotals.html)

Hozkurt

A VB Code instead of a pivot & sobtotals
 
Hello,
I have a data table consisiting of different products with
sales amounts & volumes. Any product can be included many
times. What I want to do, is to add up the amounts or
volumes of the same product. Using a pivot table,
subtotals in the VB code, slows down the process. Is
there any other way to produce a more efficient visual
basic code? The table and the result I want to achive:

Product Amount Volume
A 5 100 Eur
A 10 200 Eur
B 10 300 Eur
B 20 600 Eur The RESULT should be:

Product Amount Volume
A 15 300 Eur
B 30 900 Eur

Many Thanks,


steve

A VB Code instead of a pivot & sobtotals
 
Hozkurt,

You might use the SumIf formula in the sheet
Say your table is in cells A1:C5

Say you put A in cell A10 and B in cell A11
than in B10
==SUMIF($A$1:$A$5,$A10,$B$1:$B$5)
than fill this down to A11
you can also use it in C by changing the B's, but I'm not
sure how this will work adding Euro's.
Be sure to watch the $ signs...

If you have a long table with lots of Products you can use the
Data Filter Advanced Filter to copy unique Product names to
another place in the worksheet and than put the formulas next to this list
but be sure to change $A10 to refer to this new list.
--
sb
"Hozkurt" wrote in message
...
Hello,
I have a data table consisiting of different products with
sales amounts & volumes. Any product can be included many
times. What I want to do, is to add up the amounts or
volumes of the same product. Using a pivot table,
subtotals in the VB code, slows down the process. Is
there any other way to produce a more efficient visual
basic code? The table and the result I want to achive:

Product Amount Volume
A 5 100 Eur
A 10 200 Eur
B 10 300 Eur
B 20 600 Eur The RESULT should be:

Product Amount Volume
A 15 300 Eur
B 30 900 Eur

Many Thanks,





All times are GMT +1. The time now is 08:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com