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

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
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")
 
Upvote 0
Solution
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?
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,784
Messages
6,121,535
Members
449,037
Latest member
tmmotairi

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