sumifs only first occurrence based on two criteria

aroramon

New Member
Joined
Feb 16, 2010
Messages
2
hi all,

I have data that's formatted as follows:

[TABLE="width: 204"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Col_A
Ontario[/TD]
[TD]Col_B
Ontario1
[/TD]
[TD="align: right"]Col_C
1
[/TD]
[/TR]
[TR]
[TD]Ontario[/TD]
[TD]Ontario1[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Ontario[/TD]
[TD]Ontario2[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Ontario[/TD]
[TD]Ontario2[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Ontario[/TD]
[TD]Ontario2[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Alberta[/TD]
[TD]Alberta1[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]Alberta[/TD]
[TD]Alberta1[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]Alberta[/TD]
[TD]Alberta1[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]Alberta[/TD]
[TD]Alberta2[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD]Alberta[/TD]
[TD]Alberta3[/TD]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD]Alberta[/TD]
[TD]Alberta3[/TD]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD]Manitoba[/TD]
[TD]Manitoba1[/TD]
[TD="align: right"]6[/TD]
[/TR]
[TR]
[TD]Manitoba[/TD]
[TD]Manitoba2[/TD]
[TD="align: right"]7[/TD]
[/TR]
[TR]
[TD]Manitoba[/TD]
[TD]Manitoba2[/TD]
[TD="align: right"]7[/TD]
[/TR]
[TR]
[TD]Manitoba[/TD]
[TD]Manitoba2[/TD]
[TD="align: right"]7[/TD]
[/TR]
[TR]
[TD]Manitoba[/TD]
[TD]Manitoba3[/TD]
[TD="align: right"]8[/TD]
[/TR]
[TR]
[TD]Manitoba[/TD]
[TD]Manitoba3[/TD]
[TD="align: right"]8[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[/TR]
</tbody>[/TABLE]

on another sheet, I am looking to add a sumifs type formula based on column A which sums the data in column C, but only for the first instance of whatever value is in column b. i.e. sum for Ontario should be 1+2 = 3. Sum for Alberta should be 12. Sum for Manitoba should be 21. Thank you in advance for any help!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
This formula will sum the data for you on the same sheet - =SUMIFS($C$2:$C$18,$A$2:$A$18,A2,$B$2:$B$18,B2).
 
Upvote 0
.. sums the data in column C, but only for the first instance of whatever value is in column b. i.e. sum for Ontario should be 1+2 = 3. Sum for Alberta should be 12. Sum for Manitoba should be 21.
Try this, copied down. It is an array formula so should be entered without the {} but confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}. The formula can then be copied down.

Excel Workbook
ABCDEFG
1Col_ACol_BCol_C
2OntarioOntario11Ontario3
3OntarioOntario11Alberta12
4OntarioOntario22Manitoba21
5OntarioOntario22
6OntarioOntario22
7AlbertaAlberta13
8AlbertaAlberta13
9AlbertaAlberta13
10AlbertaAlberta24
11AlbertaAlberta35
12AlbertaAlberta35
13ManitobaManitoba16
14ManitobaManitoba27
15ManitobaManitoba27
16ManitobaManitoba27
17ManitobaManitoba38
18ManitobaManitoba38
19
SUM
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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