0
我想正確使用2d udf。用於使用sumproduct不起作用的2d查找的udf
= blookup(namedrange,HLOOKUP,VLOOKUP)
我寫了下面的,但它無法正常工作。請幫忙。
Function blookup(r, h, v)
Dim a, b, c, t, w
Dim r_count As Integer
Dim c_count As Integer
Dim x As Variant
r_count = r.Rows.Count
c_count = r.Columns.Count
t = r.Worksheet.name & "!"
a = r.Cells(2, 2).Address & ":" & r.Cells(r_count, c_count).Address
b = r.Cells(1, 2).Address & ":" & r.Cells(1, c_count).Address
c = r.Cells(2, 1).Address & ":" & r.Cells(r_count, 1).Address
x = Evaluate("=sumproduct(((" & t & b & ")=" & h & ")*((" & t & c & ")=" & v & ")*(" & t & a & "))")
blookup = x
End Function