Index Match - want to return ALL matches, not just first match

SpencerRichman

New Member
Joined
Feb 15, 2013
Messages
33
Office Version
  1. 2021
Platform
  1. Windows
I have a table of data like this:
Annual Charges
File #201220132014
120$505.00$0.00$120.00
908$15.00$1,200.00$1,425.00
862$0.00$0.00$3,750.00
908$2,000.00$105.00$25.00

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>

Notice that there are TWO rows with File #908 . I am trying to use Index Match to find the charges that match the file number in the first column and return the results of the charges in one of the annual charges columns, depending on the year. The traditional Index Match formula only returns the FIRST match of $1,425 for file #908 .

What I want is to return the SUM of ALL the matches for file #908 . But I still need to preserve the ability in the formula to choose the column based on another cell (in which I input the year that I'm working on). Any suggestions? (P.S. I'm working in Excel 2010).
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
You could use SUMPRODUCT
Excel Workbook
ABCDEFG
1File #201220132014File #908
2120$505.00$0.00$120.00Year2014
3908$15.00$1,200.00$1,425.00$1,450.00
4862$0.00$0.00$3,750.00
5908$2,000.00$105.00$25.00
Sheet
 
Upvote 0
This is how to use SUMIF with a variable range:

ABCDEFG
1File #201220132014File #908
2120$505.00 $0.00 $120.00 Year2014
3908$15.00 $1,200.00 $1,425.00 $1,450.00
4862$0.00 $0.00 $3,750.00
5908$2,000.00 $105.00 $25.00

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

Worksheet Formulas
CellFormula
G3=SUMIF(A2:A5,G1,INDEX(B2:D5,0,MATCH(G2,B2:D2)))

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

<tbody>
</tbody>
 
Upvote 0
I have a table of data like this:
Annual Charges
File #201220132014
120$505.00$0.00$120.00
908$15.00$1,200.00$1,425.00
862$0.00$0.00$3,750.00
908$2,000.00$105.00$25.00

<tbody>
</tbody>

Notice that there are TWO rows with File #908 . I am trying to use Index Match to find the charges that match the file number in the first column and return the results of the charges in one of the annual charges columns, depending on the year. The traditional Index Match formula only returns the FIRST match of $1,425 for file #908 .

What I want is to return the SUM of ALL the matches for file #908 . But I still need to preserve the ability in the formula to choose the column based on another cell (in which I input the year that I'm working on). Any suggestions? (P.S. I'm working in Excel 2010).

Hi!

Try this In G2 and copy to the right

=SUMIF($A$2:$A$5,$F2,INDEX($B$2:$D$5,,MATCH(G$1,$B$1:$D$1,0)))


ABCDEFGHIJ
1File #201220132014File #201220132014
21205050120908201513051450
39081512001425
4862003750
5908200010525
6
*******************************************************

<tbody>
</tbody>


Markmzz
 
Upvote 0
This is how to use SUMIF with a variable range:

ABCDEFG
1File #201220132014File #908
2120$505.00$0.00$120.00Year2014
3908$15.00$1,200.00$1,425.00$1,450.00
4862$0.00$0.00$3,750.00
5908$2,000.00$105.00$25.00

<tbody>
</tbody>
Sheet6

Worksheet Formulas
CellFormula
G3=SUMIF(A2:A5,G1,INDEX(B2:D5,0,MATCH(G2,B2:D2)))

<tbody>
</tbody>

<tbody>
</tbody>

This worked perfectly, thank you!
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,525
Members
448,969
Latest member
mirek8991

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