Sum values with horizontal and vertical criteria

colinheslop1984

Board Regular
Joined
Oct 14, 2016
Messages
129
Office Version
  1. 2016
How do I SUM values where one criteria is on vertical axis then the another criteria is on the horizontal axis? I.E, if I wanted to sum the BEACH for June only

[TABLE="width: 704"]
<tbody>[TR]
[TD]MONTH[/TD]
[TD]WEEK[/TD]
[TD]BEACH [/TD]
[TD]DENIM[/TD]
[TD]DRESSES[/TD]
[TD]JERSEY [/TD]
[TD]KNITWEAR[/TD]
[TD]NIGHTWEAR[/TD]
[TD]OUTERWEAR[/TD]
[TD]SHIRTS[/TD]
[TD]SHORTS[/TD]
[/TR]
[TR]
[TD]JUNE[/TD]
[TD]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]JUNE[/TD]
[TD]2[/TD]
[TD="align: right"]255[/TD]
[TD="align: right"]382[/TD]
[TD="align: right"]1362[/TD]
[TD="align: right"]956[/TD]
[TD="align: right"]1169[/TD]
[TD="align: right"]223[/TD]
[TD="align: right"]249[/TD]
[TD="align: right"]2112[/TD]
[TD="align: right"]53[/TD]
[/TR]
[TR]
[TD]JUNE[/TD]
[TD]3[/TD]
[TD="align: right"] 300[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]JUNE[/TD]
[TD]4[/TD]
[TD="align: right"] 100[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]JULY[/TD]
[TD]5[/TD]
[TD="align: right"] 455[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody><colgroup><col span="2"><col span="9"></colgroup>[/TABLE]
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hi

Enter your data into A1:K6 to understand the formula

Enter month in A8

Enter Beach in A9

Enter the following formula into B9

=SUMIFS(INDEX(C2:$K$6,0,MATCH(A9,$C$1:$K$1,0)),$A$2:$A$6,A8)

Let me know how you go.

Kind regards

Saba
 
Upvote 0
Hi

Enter your data into A1:K6 to understand the formula

Enter month in A8

Enter Beach in A9

Enter the following formula into B9

=SUMIFS(INDEX(C2:$K$6,0,MATCH(A9,$C$1:$K$1,0)),$A$2:$A$6,A8)

Let me know how you go.

Kind regards

Saba


Thanks but I get an error #N/A
 
Upvote 0
Hi,

Try this:


Book1
ABCDEFGHIJK
1MONTHWEEKBEACHDENIMDRESSESJERSEYKNITWEARNIGHTWEAROUTERWEARSHIRTSSHORTS
2JUNE1021111111
3JUNE225538213629561169223249211253
4JUNE3300
5JUNE4100
6JULY5455
7
8CriteriaBEACH
9MonthJUNE
10Result655
Sheet102
Cell Formulas
RangeFormula
B10=SUMPRODUCT((A2:A6=B9)*(C1:K1=B8)*C2:K6)
 
Upvote 0
That Is strange, Aladin.

Tested with TEXT numbers in C2:C6, the SUMIFS/INDEX/MATCH returns 0.
SUMPRODUCT still holds and returns 655.

However, Inserted leading/trailing Space in C1, SUMIFS/INDEX/MATCH returns #N/A error.
SUMPRODUCT returns 0

So OP needs to "clean-up" C1:K1
 
Upvote 0
Thank you Aladin and Jtakw,

colinheslop1984, as suggested by Jtakw, you may want to remove leading and trailing spaces as look value and lookup arrays must be the same. You can use Trim function to do this.

Kind regards

Saba
 
Upvote 0

Forum statistics

Threads
1,224,821
Messages
6,181,163
Members
453,021
Latest member
Justyna P

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