index and match function with named ranges

icordeiro

New Member
Joined
Dec 13, 2016
Messages
25
I have these two tables on the same sheet:

ABCDEFGHIJK
Inst(1)dti(1)dft(1)Valor liquidoIVAVazioInst(2)dti(2)Dtf(2)KWh
20419820100701201109302,88620419820100611201006305,88
20419820111001201207021,1513204198201110012012070212,3
20419820100611201006300,555204198201007012011093030

<tbody>
</tbody>

I want to use the functions index and match to look for the value on the column 'KWh' to fill the column 'Vazio'.

I have three criteria - cells in Inst(1), dti(1) and dtf(1)
And three search ranges - inst(2), dti(2) and dtf(2)

This is what I've done so far:

Code:
Dim tgt As Worksheet
Dim search1 As Range
Dim search2 As Range
Dim search3 As Range
Dim output1 As Range
Dim output2 As Range
Dim output3 As Range
Dim output4 As Range
 
Dim lastrow As Long
 
 
 
 

Set tgt = ThisWorkbook.Sheets("Consulta")
 

 
Set search1 = tgt.Range("H10:H12")
Set search2 = tgt.Range("I10:I12")
Set search3 = tgt.Range("J10:J12")

Set output1 = tgt.Range("K10:K12")

tgt.Range("G10").FormulaArray = _
"=Index(" & output1.Address & ", Match(RC[-5]&RC[-4]&RC[-3], " & search1.Address & " & " & search2.Address & " & " & search3.Address & "), 0)"

But it's not working. Any ideias?

Thanks.
 

Some videos you may like

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

icordeiro

New Member
Joined
Dec 13, 2016
Messages
25
On this case

Code:
tgt.Range("G10").FormulaArray = _

the cell where I want the formula would be "F10"

 

Watch MrExcel Video

Forum statistics

Threads
1,122,806
Messages
5,598,188
Members
414,218
Latest member
speedbit

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