Macro help - adding totals by name that may occur multiple times

rubatoguy

New Member
Joined
Aug 9, 2013
Messages
10
I have a spreadsheet that is sorted in name order that lists name, code and and amount.
The name may appear multiple times, usually either 1, 2 or 3 times. Currentyl I am adding the amount manually, and I was thinking there must be a way to create a macro to do this. So, my worksheet looks like so:

NAME CODE MINUTES
SMITH, SAM E F 100
SMITH, SAM E F 200
SMITH, SAM E S 360
TAYLOR, JANE Z F 100
ZACK, WILL T S 120
ZACK, WILL T S 120
ZIPPER, GEORGE F 240
ZIPPER, GEORGE F 120
ZIPPER, GEORGE F 120

I want to end up with:
SMITH, SAM E F 300
SMITH, SAM E S 360
TAYLOR, JANE Z F 100
ZACK, WILL T S 240
ZIPPER, GEORGE F 480

The key is to add the numbers when the name and code match, and end up with a single row with the total.
Is there a way to do this in a macro?

Thanks,
Todd
A Macro neophyte.
 
You can do that with a SUMIFS() function if you have a list of the names. This example only uses 100 rows.
=SUMIFS(C1:C100, A1:A100, "Smith, Sam E",B1:B100, "F")
=SUMIFS(C1:C100, A1:A100, "Smith, Sam E",B1:B100, "S")
You would need two formulas for each name. However, if you have more codes than F and S then VBA would probably be a better solution.
 
Upvote 0

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