I have these two tables on the same sheet:
<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:
But it's not working. Any ideias?
Thanks.
A | B | C | D | E | F | G | H | I | J | K |
Inst(1) | dti(1) | dft(1) | Valor liquido | IVA | Vazio | Inst(2) | dti(2) | Dtf(2) | KWh | |
204198 | 20100701 | 20110930 | 2,88 | 6 | 204198 | 20100611 | 20100630 | 5,88 | ||
204198 | 20111001 | 20120702 | 1,15 | 13 | 204198 | 20111001 | 20120702 | 12,3 | ||
204198 | 20100611 | 20100630 | 0,55 | 5 | 204198 | 20100701 | 20110930 | 30 |
<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.