Simple Loop & Sum Question

lhernandez

Active Member
Joined
May 22, 2006
Messages
282
OK, this should be an easy question, but for some reason my logic is not working.
I have a spreadsheet with approx. 900 lines. Column D has a "code" to break up the column into different groups, but the codes are scattered throughout. Column K has a quantity in it.
How can I write a loop to sum up all the values that are within a "code"?
Ex:
AAA - 2
AAA - 2
ABA - 2
ACB - 4
BBB - 7
ABA - 6
ACB - 3
BBB - 1
BBB - 1

So for all AAA sum the values and so on.
Is this possible if I do not know the code?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
Couldn't you just use a pivot table or a SUMIF formula?
 

Forum statistics

Threads
1,137,367
Messages
5,681,075
Members
419,950
Latest member
BeckiJae

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
Top