Sum by name

Luke777

Board Regular
Joined
Aug 10, 2020
Messages
246
Office Version
  1. 365
Platform
  1. Windows
Hi,

This is a basic question but I’m wondering what the quickest way to sum column 3 based on column 1 AND column 2 using VBA.

Col1 contains first name, col2 second names, col 3 contains a number.

Where first and last names match, sum column 3.

I figured I should produce a list of uniques (by column1 and 2) but from there I got a little stuck on exactly what method to use

Any suggestions would be appreciated

Thanks!
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Do you mean when first and last names match each other (that wouldn't make sense to me) or match some filter criteria (but you didn't say where the criteria are)? Any particular reason this needs to be VBA? Because I would do this with a SUMIFS formula.
 
Upvote 0
Do you mean when first and last names match each other (that wouldn't make sense to me) or match some filter criteria (but you didn't say where the criteria are)? Any particular reason this needs to be VBA? Because I would do this with a SUMIFS formula.
Sorry, I mean where first and last names match within the columns… for example, there might be 20 rows containing John (1) Smith (2) - I want the sum total of those 20 rows as found in column 3. So if all the entries are John Smith 10 the result would be 200.

Yes, VBA because the sheet I’m working with is completely blank until I import, trim and transform data at the press of a button.

I’ll be using the sum method to replace multiple entries (twenty John smiths) with a single entry (John smith total). The rest of it is relatively easy (already done)… I just need a totaliser.

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

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