# SUM, INDEX, MATCH with 2 criteria in rows and columns

#### Bethany Sachtleben

##### New Member
Hi,

I'm trying to return the sum of all the amounts under the Source "INAP Ubersmith" for the month of January. As you can see in this screenshot, The source criteria is in a column and the month criteria is in a row. My current formula returns all amounts for the month of January but it does not single out the source I want.

Here is the current formula: =SUM(INDEX(Sheet1!G4:H163,0,MATCH(CC2,Sheet1!G3:H3,0),1))

This formula is in a different tab in the same workbook, so "sheet 1" is the below data and "CC2" is simply a cell with the word "Jan".

Would really appreciate any help!

### Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

#### jasonb75

##### Well-known Member
It looks like you need to use SUMIFS instead of SUM
Excel Formula:
``=SUMIFS(INDEX(Sheet1!\$G\$4:\$H\$163,0,MATCH(CC2,Sheet1!\$G\$3:\$H\$3,0)),Sheet1!\$C\$4:\$C\$163,"INAP Ubersmith")``

#### Bethany Sachtleben

##### New Member
It looks like you need to use SUMIFS instead of SUM
Excel Formula:
``=SUMIFS(INDEX(Sheet1!\$G\$4:\$H\$163,0,MATCH(CC2,Sheet1!\$G\$3:\$H\$3,0)),Sheet1!\$C\$4:\$C\$163,"INAP Ubersmith")``
Thanks a ton! It worked!

#### Bethany Sachtleben

##### New Member
It looks like you need to use SUMIFS instead of SUM
Excel Formula:
``=SUMIFS(INDEX(Sheet1!\$G\$4:\$H\$163,0,MATCH(CC2,Sheet1!\$G\$3:\$H\$3,0)),Sheet1!\$C\$4:\$C\$163,"INAP Ubersmith")``
Follow up question: I'm trying to add an additional criteria within the match formula so that it also looks at the year and sums values from 2021. How would I imbed that within the formula?

#### jasonb75

##### Well-known Member
You would need a totally different formula if you have more than 1 criteria for the columns as well.
Excel Formula:
``=SUMPRODUCT(Sheet1!\$G\$4:\$H\$163,(Sheet1!\$C\$4:\$C\$163="INAP Ubersmith")*(Sheet1!\$G\$2:\$H\$2=2021))``
There are a number of ways but this would be the most reliable.

Replies
3
Views
102
Replies
4
Views
61
Replies
3
Views
60
Replies
3
Views
157
Replies
3
Views
287

1,129,264
Messages
5,635,153
Members
416,844
Latest member
ryanangus496

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

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