Macro To Sum Lines With Same Criteria

crashing1912

New Member
Joined
Sep 8, 2011
Messages
19
I need a macro to "subtotal" the data below. Basically, there are invoices that can have different "Types" of costs on them, however, sometimes the information provided by the billing dept. the types can be repeated. For example, invoice 57 for Kansas has P listed twice, as well as T. I need the macro to sum columns Gross, Discount & billed for "P" on to one line.
The criteria would be sum Gross, Discount, & billed when the state, invoice & type are the same.
StateInvoiceTypeGrossDiscountBilled
Michigan56T5000500
Michigan56R100050
Kanas57P1000100
Kansas57P3000300
Kansas57T1000100
Texas58R2000200
Texas58R1000100
Oklahoma59T2000200
Oklahoma59T3000300

<tbody>
</tbody>


The end result should look like this:

StateInvoiceTypeGrossDiscountBilled
Michigan56T5000500
Michigan56R100050
Kansas57P4000400
Kansas57T1000100
Texas58R3000300
Oklahoma59T5000500

<tbody>
</tbody>
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,214,990
Messages
6,122,625
Members
449,093
Latest member
catterz66

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