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

Bethany Sachtleben

New Member
Joined
Feb 3, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
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".

Mr Excel Capture.PNG


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
Joined
Dec 30, 2008
Messages
12,589
Office Version
  1. 365
Platform
  1. Windows
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")
 
Solution

Bethany Sachtleben

New Member
Joined
Feb 3, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
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
Joined
Dec 30, 2008
Messages
12,589
Office Version
  1. 365
Platform
  1. Windows
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.
 

Watch MrExcel Video

Forum statistics

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

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
Top