Sumif in selected rows only

drluke

Active Member
Joined
Apr 17, 2014
Messages
314
Office Version
  1. 365
Platform
  1. Windows
ABCDE
1A526Dec-15North W 56.25 548.75
2A526Dec-16South E 56.25
3A526Dec-17Wales 100.00
4A526Mar-18Scotl 26.25
5A526May-18Ldn A 112.50
6A526Jul-18Ldn B 103.75
7A526Aug-18Wales 93.75
8A897Jan-18North W 769.67 1,840.69
9A897Feb-18South E 669.50
10A897Mar-18Wales 58.40
11A897Apr-18Scotl 28.00
12A897May-18Ldn A 120.12
13A897Jun-18Ldn B 195.00
I currently have a sum formula in E1, E8 etc., but I would rather have a formula that I can copy down all of the rows that will
(a) sum all the amounts in column D for all rows that have the same code in col, A
(b) the result in col D must only be on the first row where there is a change in col A
Any help would be much appreciated.
<colgroup><col width="64" style="width: 48pt;"> <col width="65" style="width: 49pt; mso-width-source: userset; mso-width-alt: 2377;"> <col width="64" style="width: 48pt;"> <col width="65" style="width: 49pt; mso-width-source: userset; mso-width-alt: 2377;"> <col width="64" style="width: 48pt;"> <col width="74" style="width: 56pt; mso-width-source: userset; mso-width-alt: 2706;"> <col width="73" style="width: 55pt; mso-width-source: userset; mso-width-alt: 2669;"> <col width="64" style="width: 48pt;" span="6"> <tbody> </tbody>
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Is the data sorted by column A? If so:

=IF(COUNTIF($A$1:A1,A1)=1,SUMIF(A:A,A1,D:D),"")
 
Upvote 0
Yes it is! Thank you this works.
If I added 2 additional columns E & F, how could I change the formula to sum columns D,E & F with the result in col G?
 
Upvote 0
Yes it is! Thank you this works.
If I added 2 additional columns E & F, how could I change the formula to sum columns D,E & F with the result in col G?

Control+shift+enter, not just enter:

=IF(COUNTIFS($A$1:A1,A1)=1,SUM(IF($A$1:$A$13=A1,$D$1:$F$13)),"")
 
Upvote 0

Forum statistics

Threads
1,215,813
Messages
6,127,029
Members
449,355
Latest member
g wiggle

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