Macro to summarize total line items per invoice

SaraQuinn

New Member
Joined
May 19, 2023
Messages
12
Office Version
  1. 365
Platform
  1. Windows
Hello, I need a macro that summs the totals per invoice line items in columns H and also repeat in column H to match the total of the invoice in column F per unique coding (service/loc) under column E
1715009939208.png
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
MSSL Import Sample.xlsx
ABCDEFGHIJKLMNOPQ
1Batch202312H50,043.11Notes:
2InvoiceIN819436KLSSTE12/12/202329,847.35819436301/11/20241100CP-CORCorrect Service/Loc to TR-SCF
3Transaction4050TR-NAP1884.06884.06Summarize the total of each Service /Loc to match the invoice total
4Transaction4050HN-NAP1662.49662.49One line TR-SCF total 12785.61
5Transaction4050TR-NAP1852.02852.02One line HN-NAP Total 17061.74
6Transaction4050HN-NAP1638.48638.48
7Transaction4050TR-NAP1869.22869.22
8Transaction4050HN-NAP1651.37651.37
9Transaction4050TR-NAP1888.81888.81
10Transaction4050HN-NAP1666.05666.05
11Transaction4050TR-NAP1892.64892.64
12Transaction4050HN-NAP1668.92668.92
13Transaction4050TR-NAP1887.5887.5
14Transaction4050HN-NAP1665.07665.07
15Transaction4050TR-NAP1840.85840.85
16Transaction4050HN-NAP1630.11630.11
17Transaction4050TR-NAP1787.11787.11
18Transaction4050HN-NAP1589.84589.84
19Transaction4050TR-NAP1827.85827.85
20Transaction4050HN-NAP1620.37620.37
21Transaction4050HN-NAP1644.79644.79
22Transaction4050TR-NAP1860.44860.44
23Transaction4050HN-NAP1660.13660.13
24Transaction4050TR-NAP1880.91880.91
25Transaction4050HN-NAP1649.94649.94
26Transaction4050TR-NAP1867.31867.31
27Transaction4050TR-NAP1819.59819.59
28Transaction4050HN-NAP1614.18614.18
29Transaction4050HN-NAP1627.45627.45
30Transaction4050TR-NAP1837.3837.3
31Transaction4050HN-NAP1600.78600.78
32Transaction4050TR-NAP1801.71801.71
33Transaction4050HN-NAP1654.18654.18
34Transaction4050TR-NAP1872.97872.97
35Transaction4050TR-NAP1864.03864.03
36Transaction4050HN-NAP1647.48647.48
37Transaction4050HN-NAP1659.56659.56
38Transaction4050TR-NAP1880.15880.15
39Transaction4050HN-NAP1620.57620.57
40Transaction4050TR-NAP1828.12828.12
41Transaction4050TR-NAP1819.15819.15
42Transaction4050HN-NAP1613.85613.85
43InvoiceIN819437KLSSTE12/12/202318,016.99819437301/11/20241100CP-COR
44Transaction4050TR-NAP1866.27866.27
45Transaction4050HN-NAP1649.16649.16
46Transaction4050TR-NAP1848.43848.43
47Transaction4050HN-NAP1635.79635.79
48Transaction4050TR-NAP1829.12829.12
49Transaction4050HN-NAP1621.32621.32
50Transaction4050HN-NAP1634.3634.3
51Transaction4050TR-NAP1846.44846.44
52Transaction4050TR-NAP1839.86839.86
53Transaction4050HN-NAP1629.37629.37
54Transaction4050TR-NAP1878.36878.36
55Transaction4050HN-NAP1658.22658.22
56Transaction4050HN-NAP1667.19667.19
57Transaction4050TR-NAP1890.33890.33
58Transaction4050TR-NAP1883.47883.47
59Transaction4050HN-NAP1662.05662.05
60Transaction4050HN-NAP1636.57636.57
61Transaction4050TR-NAP1849.47849.47
62Transaction4050HN-NAP1605.83605.83
63Transaction4050TR-NAP1808.45808.45
64Transaction4050TR-NAP1892.48892.48
65Transaction4050HN-NAP1668.8668.8
66Transaction4050HN-NAP1649.28649.28
67Transaction4050TR-NAP1866.43866.43
68InvoiceIN819438KLSSTE12/12/20235,683.37819438301/11/20241100CP-COR
69Transaction4050HN-NAP11272.531272.53
70Transaction4050TR-NAP1778.46778.46
71Transaction4050TR-NAP1688.28688.28
72Transaction4050HN-NAP11125.11125.1
73Transaction4050HN-NAP11128.591128.59
74Transaction4050TR-NAP1690.41690.41
75InvoiceIN819457UPDS12/12/2023282.73819457301/11/20241101CP-CORSummarize totals not showing negatives
76Transaction4049HN-PDX1286.03286.03one line total 282.73
77Transaction4049HN-PDX1-3.3-3.3
78InvoiceIN819458UPDS12/12/2023212.67819458301/11/20241101CP-COR
79Transaction4049HN-PDX1214.33214.33
80Transaction4049HN-PDX1-1.66-1.66
Original Batch 1783
 
Upvote 0
Here what I would like the result to look like
MSSL Import Sample.xlsx
ABCDEFGHIJKLMNO
1Batch202312H50,043.11
2InvoiceIN819436KLSSTE12/12/202329,847.35819436301/11/20241100CP-COR
3Transaction4050HN-NAP112785.6112785.61
4Transaction4050TR-SCF117,061.7417061.74
5InvoiceIN819437KLSSTE12/12/202318,016.99819437301/11/20241100CP-COR
6Transaction4050HN-NAP17717.887717.88
7Transaction4050TR-SCF110299.1110299.11
8InvoiceIN819438KLSSTE12/12/20235,683.37819438301/11/20241100CP-COR
9Transaction4050HN-NAP13526.223526.22
10Transaction4050TR-SCF12157.152157.15
11InvoiceIN819457UPDS12/12/2023282.73819457301/11/20241101CP-COR
12Transaction4049HN-PDX1282.73282.73
13InvoiceIN819458UPDS12/12/2023212.67819458301/11/20241101CP-COR
14Transaction4049HN-PDX1212.67212.67
Data After Running Macro
Cell Formulas
RangeFormula
H4H4=F2-H3
H12,H14H12=F11
I12,I14I12=F11
 
Upvote 0

Forum statistics

Threads
1,216,507
Messages
6,131,059
Members
449,616
Latest member
PsychoCube

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