Sum cells in range based on matching/non unique identifiers

hma87

New Member
Joined
Nov 9, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
1668031163310.png


Hi there!
I'm trying to find the total subtotal generated by marketing. For some rows, this is easy, as I can just say that 7.38 in spend generated 31.95 in revenue (row 111), for example. However, with a certain type of ad the spend and revenue information is coming as two separate transactions. The 3.89 of marketing spend (row 113) for example, is responsible for the 31.95 in row 115, which we can be certain of because of their matching ID's in column M. I'm looking to sum all the order* subtotals where their ID is duplicated / associated with an ad fee. Because I'm trying the whole broader process into a macro later on, it would be much more useful if this could be done in one formula rather than identifying them with one, laying them out in a separate column, and then summing them. Thanks for your help!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
This is probably not what you were expecting, but the easiest way is to use the Powerquery tools. I'm assuming that the data above is exported from an accounting tool.

On the in the 'Get & Transform' tab of the Data Ribbon in Excel, select 'From Table/Range'. Choose the 'Transform' option. This will open your source table in the Powerquery User Interface. On the 'Transform' ribbon you'll find 'Group By'. When the dialogue opens select the code column on which to group by, then click on the 'advanced' option to allow multiple aggregations. One option worth doing is to click on an aggregation operation and selection 'all rows', which will allow you to reopen all the rows should you wish. When you click Ok you'll get a grouped table with the columns summed. If you click on 'Close & Load' on the Home ribbon you new table will be created on a new sheet in your spreadsheet (other options are available). If your source data is updated only a Refresh is required to update the grouped data.

This is a hugely powerful tool that is worth learning.

Hope this helps.

Regards

Peter
 
Upvote 0
Thank you for your reply. Sadly while this may be from an accounting tool (Doordash's) I do not have access to that, only the csv files they allow us to download (pictured).
 
Upvote 0
That’s not a problem. You can use Powerquery to open the csv file directly. On the Get and Transform Tab chose Get From and then chose csv. You then navigate to wherever that is stored and transform it however you need.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,749
Members
448,989
Latest member
mariah3

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