Hi,
Better you need an UDF as there are cells having multiple 'OBS' to look.
How to use this UDF.Code:Function PAREDES(ByRef LookupValue, ByRef LookupTable As Range, ByVal ColIdx As Long) As Double Dim TblAry As String, x, i As Long If TypeOf LookupValue Is Range Then LookupValue = LookupValue.Value2 TblAry = "'" & LookupTable.Parent.Name & "'!" & LookupTable.Address x = Split(LookupValue, ",") For i = 0 To UBound(x) PAREDES = PAREDES + Evaluate("vlookup(""" & Trim$(x(i)) & """," & TblAry & "," & ColIdx & ",0)") Next End Function
Copy this code > Open the workbook > Hit Alt + F11 > Go to Insert > Module and paste the code. Now hit Alt + Q to close the VBE window.
In F10:
=(D10*E10)-PAREDES(A10,$H$3:$L$14,5)
copy the formula in F23
HTH




Reply With Quote

Bookmarks