SUMIFS in a 2-Dimensional Array

Tarver

Board Regular
Joined
Nov 15, 2012
Messages
109
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I'm struggling with SUMIFS today for some reason.

I've got an array of cells that contains data based upon a week and year, for different sources which are named in column A, like this:

ABCDE
1WK 1-18WK 2-18WK 3-18WK 4-18
2Sally1234
3Joe481632
4Susie2468
5James369

<tbody>
</tbody>

I need to sum these values by a name, for a range of weeks. The name I need to sum is located in cell A10, and the start week is in B10 and ending week is in C10

What I'm coming up with looks like this:
=SUMIFS(B2:E5,B2:E2,">="&B10,B2:E2,"<="&C10,A2:A5,A10)

This results in a value error.

B2:E5 is the table of values (Sum range)
B2:W2 is the date ranges (Criteria Range 1 and Criteria Range 2)
">="&B10 should, if I'm doing it right, include all values greater than my start week. (Criteria 1)
"<="&C10 should, again, if I'm doing it correctly, include weeks less than my start week. (Criteria 2)
A2:A5 is my range of names, and (Criteria Range 3)
A10 is the criteria to match my target name. (Criteria 3)

Any ideas on what I'm doing wrong? Your help is most appreciated.

I'm not tied to SUMIFS. If there's a better way, I'm glad to hear your suggestions.
 
Last edited:

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Here are 2 options:

Excel 2012
ABCDE
1Name / Week:1234
2Sally1234
3Joe481632
4Susie2468
5James369
6
7
8
9
10Susie23
11
12Sum:10
13Sum:10

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet6

Worksheet Formulas
CellFormula
B12=SUMPRODUCT(B2:E5*(A2:A5=A10)*(B2:E2>=B10)*(B2:E2<=C10))
B13=SUMIFS(INDEX(B2:E5,MATCH(A10,A2:A5,0),0),B2:E2,">="&B10,B2:E2,"<="&C10)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



I think your range descriptions were a little inconsistent, but see how they are set up in my example. Also, notice I just used a number for the week, since it's more difficult to work around text. You could use a custom format if you want, to keep the easier formulas and still see "WK 1".
 
Upvote 0
Hi Eric,

I think there a typo in your formulas.
Shouldn't it be?
=SUMPRODUCT(B2:E5*(A2:A5=A10)*(B1:E1>=B10)*(B1:E1<=C10))

The same in SUMIFS

M.
 
Last edited:
Upvote 0
The formulas should be:

CellFormula
B12=SUMPRODUCT(B2:E5*(A2:A5=A10)*(B1:E1>=B10)*(B1:E1<=C10))
B13=SUMIFS(INDEX(B2:E5,MATCH(A10,A2:A5,0),0),B1:E1,">="&B10,B1:E1,"<="&C10)

<tbody>
</tbody>

<tbody>
</tbody>

The only worked in my previous post since the values on row 2 were the same as row1. :oops:


Edit: Yeah, good catch, Marcelo!
 
Last edited:
Upvote 0
Great answer, thanks! SUMPRODUCT is the way to go.
 
Upvote 0

Forum statistics

Threads
1,215,622
Messages
6,125,889
Members
449,270
Latest member
bergy32204

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