# Complex Countifs/Index/Match/Array?

#### towners

##### Board Regular
Hi,

I could do with some help to work out how to calculate from the example below: (sorry I don't know how to paste image/worksheet).

Month Jan Jan Jan Jan Feb Feb Feb Feb
Apples 4 4 5 4 5 2 4 5
Pears 2 1 3 2 2 1 3 2

I would like to use a formula to show:

Apples sold in month & Pears sold in month.

Can anyone point me in the right direction?

Thanks

Towners

### Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hello,

If your months are formatted as dates, the select whole data.
Copy / paste special and transpose to a different location
Select the copied data and insert a pivot table

 Month Apple Pears janv-15 4 2 janv-15 4 1 janv-15 5 3 janv-15 4 2 févr-15 5 2 févr-15 2 1 févr-15 4 3 févr-15 5 2

<tbody>
</tbody>

Pivot table result =
 Row Labels Sum of Apple Sum of Pears janv-15 17 8 févr-15 16 8 Grand Total 33 16

<tbody>
</tbody>

Try...

=SUMIFS(INDEX(\$B\$2:\$I\$3,MATCH("apples",\$A\$2:\$A\$3,0)),\$B\$1:\$I\$1,"jan")

And here is my version...

Excel 2010
ABCDEFGHI
1JanJanJanJanFebFebFebFeb
2Apples44545345
3Pears21322132
4
5JanFeb
6Apples1717
7Pears88
Sheet5
Cell Formulas
RangeFormula
B6=SUMPRODUCT(\$B\$2:\$I\$3*(\$B\$1:\$I\$1=B\$5)*(\$A\$2:\$A\$3=\$A6))
B7=SUMPRODUCT(\$B\$2:\$I\$3*(\$B\$1:\$I\$1=B\$5)*(\$A\$2:\$A\$3=\$A7))
C6=SUMPRODUCT(\$B\$2:\$I\$3*(\$B\$1:\$I\$1=C\$5)*(\$A\$2:\$A\$3=\$A6))
C7=SUMPRODUCT(\$B\$2:\$I\$3*(\$B\$1:\$I\$1=C\$5)*(\$A\$2:\$A\$3=\$A7))

Try...

=SUMIFS(INDEX(\$B\$2:\$I\$3,MATCH("apples",\$A\$2:\$A\$3,0)),\$B\$1:\$I\$1,"jan")

The formula misses an important piece. Here is the full version...

 Row\Col A​ B​ C​ D​ E​ F​ G​ H​ I​ J​ K​ L​ M​ 1​ Month Jan Jan Jan Jan Feb Feb Feb Feb jan feb 2​ Apples 4​ 4​ 5​ 4​ 5​ 2​ 4​ 5​ apples 17​ 16​ 3​ Pears 2​ 1​ 3​ 2​ 2​ 1​ 3​ 2​ pears 8​ 8​

L2, copied across and down:

=SUMIFS(INDEX(\$B\$2:\$I\$3,MATCH(\$K2,\$A\$2:\$A\$3,0),0),\$B\$1:\$I\$1,L\$1)

That is exactly the result and formula I was looking for. Now I can combine this with my dynamic named ranges and it's a smart little function.

Regards

Towners

That is exactly the result and formula I was looking for. Now I can combine this with my dynamic named ranges and it's a smart little function.

Regards

Towners

Great. Thanks for the informative feedback.

Replies
4
Views
320
Replies
0
Views
173
Replies
1
Views
286
Replies
0
Views
414
Replies
4
Views
735

1,196,391
Messages
6,015,006
Members
441,865
Latest member
Enragedpanda

### 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.

### Which adblocker are you using?

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

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