I want to use a function within sumproduct that doesn't take an array. For example, I have this dataset:
+---------+----------------------------------------------+--------+-----+
| Topic | Eq | Weight | Val |
+---------+----------------------------------------------+--------+-----+
| Topic 1 | LOGNORM.DIST(val,2.4,0.4, FALSE)*10.2027*D50 | 13 | 5 |
| Topic 2 | val/10 | 10 | 4 |
| Topic 3 | val^2 | 5 | 2 |
+---------+----------------------------------------------+--------+-----+
I wrote a Visual Basic module to evaluate the equations:
Public Function eval(s As String) As Variant
eval = Evaluate(s)
End Function
And basically, I just want to be able to insert the "val" column into the equation, and then multiply against the weight and get an array of sums.
I tried this:
=SUMPRODUCT(IF(ISNUMBER(H$7:H$31),Dist(H$7:H$31,$D$7:$D$31,$E$7:$E$31))
where Dist is a lambda function:
LAMBDA(val,eq,weight,eval(CONCAT("=",SUBSTITUTE(eq,"val",val))))
But anytime I have a table longer than 1 row, it yells at me with an #N/A or #VALUE error, presumably because the LOGNORM.DIST function doesn't like having more than 1 value.
Is there a way to coerce an excel function into taking an array?
MAPbut you figured it out. I cannot test it because I use Excel web and you need Name Manager for that. I am glad it worked