Products se vba to sum qty

Graham JN

New Member
Joined
Apr 15, 2018
Messages
13
Help lol
i have data in a sheet and it is variable number of rows always changes.
within each row of data is various columns of data.
i would like it to consolidate the data to a new sheet so that any identical product codes are consolidated so I just have number of products for each code.

[TABLE="width: 500, align: left"]
<tbody>[TR]
[TD]Product code
[/TD]
[TD]qty[/TD]
[TD]Price buying[/TD]
[TD]Selling £[/TD]
[TD]Total[/TD]
[/TR]
[TR]
[TD]A1234[/TD]
[TD]3[/TD]
[TD]20[/TD]
[TD]30[/TD]
[TD]90[/TD]
[/TR]
[TR]
[TD]A1234[/TD]
[TD]3[/TD]
[TD]20[/TD]
[TD]30[/TD]
[TD]90[/TD]
[/TR]
[TR]
[TD]A1235[/TD]
[TD]3[/TD]
[TD]20[/TD]
[TD]30[/TD]
[TD]90[/TD]
[/TR]
[TR]
[TD]results are like[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A1234[/TD]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A1235[/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Welcome to the MrExcel board!

Excel's built-in Pivot Table feature can do that for you.

1. Select A1:B(end of data) That is Product code & qty columns, including headings.
2. 'Insert' ribbon tab -> PivotTable -> OK
That should produce a new sheet with a PivotTable panel at the right. In that panel ..
3. Click & drag Product code text from the top section to the 'Rows' section at bottom left
4. Click & drag the qty text from the top section to the 'Values' section at the bottom right
All done :)

Here is the result for me:

Excel Workbook
AB
1
2
3Row LabelsSum of qty
4A12346
5A12353
6Grand Total9
7
Sheet5
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,194
Members
453,021
Latest member
pingpong7117

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top