Index and match?

fingermouse

Board Regular
Joined
Dec 13, 2013
Messages
117
Hi,

I have a problem which I cant solve, will do my best to explain. I think I need something called an index match formula? but I cant get it to work.

I have two excel spreadsheet tabs. Tab 1 contains the data I want to extract, tab 2 will contain the formula

The table below is an extract of tab 1. There are multiple rows for each ref no, of which I have approx 40.

Ref no
EHO

<tbody>
</tbody><colgroup><col></colgroup>
HGBILF
NIRHI0000436576,13077,06035.64
NIRHI0000436550,23651,43024.05
NIRHI0000436550,24779,18036.22

<tbody>
</tbody>

Tab 2 is where I want to have my formula.
Ref noEHOLookup for HGBI in this column cellsLookup for LF in this column cells
NIRHI0000436576,130
NIRHI0000436550,236
NIRHI0000436550,247

<tbody>
</tbody>


What I essentially want to do is pull through both the 'HGBI' and 'LF' values from tab 1 where there is a corresponding 'Ref no' AND 'Eligible Heat Output' value in tab 2. Does that make sense? I tried a VLOOKUP but it only pulls out the first value it finds. I have tried reading tutorials on this but find it confusing. If anyone can provide the formula that would be much appreciated. Thanks, Cal.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Re: need a formula! - index andf match?

Is there only one instance of ref number and EHO combination?
 
Upvote 0
Re: need a formula! - index andf match?

If there are multiple ref number and EHO combinations this will pull the first one only.


Excel 2010
ABCD
1Ref noEHOHGBILF
2NIRHI0000436576,13077,06035.64
3NIRHI0000436550,23651,43024.05
4NIRHI0000436550,24779,18036.22
Sheet6



Excel 2010
ABCD
1Ref noEHOHGBILF
2NIRHI0000436576,13077,06035.64
3NIRHI0000436550,23651,43024.05
4NIRHI0000436550,24779,18036.22
Sheet7
Cell Formulas
RangeFormula
C2{=INDEX(Sheet6!C$2:C$4,MATCH($A2&$B2,Sheet6!$A$2:$A$4&Sheet6!$B$2:$B$4,0))}
C3{=INDEX(Sheet6!C$2:C$4,MATCH($A3&$B3,Sheet6!$A$2:$A$4&Sheet6!$B$2:$B$4,0))}
C4{=INDEX(Sheet6!C$2:C$4,MATCH($A4&$B4,Sheet6!$A$2:$A$4&Sheet6!$B$2:$B$4,0))}
D2{=INDEX(Sheet6!D$2:D$4,MATCH($A2&$B2,Sheet6!$A$2:$A$4&Sheet6!$B$2:$B$4,0))}
D3{=INDEX(Sheet6!D$2:D$4,MATCH($A3&$B3,Sheet6!$A$2:$A$4&Sheet6!$B$2:$B$4,0))}
D4{=INDEX(Sheet6!D$2:D$4,MATCH($A4&$B4,Sheet6!$A$2:$A$4&Sheet6!$B$2:$B$4,0))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Re: need a formula! - index andf match?

As you are using numbers you can use SUMIFS:

=SUMIFS(Sheet1!$C$2:$C$4,Sheet1!$A$2:$A$4,A2,Sheet1!$B$2:$B$4,B2)
=SUMIFS(Sheet1!$D$2:$D$4,Sheet1!$A$2:$A$4,A2,Sheet1!$B$2:$B$4,B2)

Another potential should they not all be numbers:

=LOOKUP(2,1/((Sheet1!$A$2:$A$4=A2)*(Sheet1!$B$2:$B$4=B2)),Sheet1!$C$2:$C$4)
=LOOKUP(2,1/((Sheet1!$A$2:$A$4=A2)*(Sheet1!$B$2:$B$4=B2)),Sheet1!$D$2:$D$4)
 
Upvote 0
In C2 of Sheet2 control+shift+enter, not just enter, and copy down:
Rich (BB code):
=IF(COUNTIFS(Sheet1!$A$2:$A$400,$A2,Sheet1!$B$2:$B$400,$B2)>1,"Error: Duplicate record",
    IFERROR(INDEX(Sheet1!$B$2:$B$400,MATCH($B2,IF(Sheet1!$A$2:$A$400=$A2,Sheet1!$B$2:$B$400),0)),"Error: Not Found"))


In D2 of Sheet2, control+shift+enter, not just enter, and copy down:
Rich (BB code):
=IF(COUNTIFS($C2,"Error:*),$C2,INDEX(Sheet1!$C$2:$C$400,MATCH($B2,IF(Sheet1!$A$2:$A$400=$A2,Sheet1!$B$2:$B$400),0)))

 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,577
Messages
6,125,637
Members
449,242
Latest member
Mari_mariou

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