So I've been trying to create a function to add together decibels in VBA. I've tried to use ParamArray but I'm having trouble with information processing. Ideally, it would work as SUM() and just take all of the inputs and throw it in a formula and boom.
Right now, I have:
Function DBADD3(ParamArray nums()) As Double
Dim DBPrTot As Variant
'this will be input into the log function at the end
DBPrTot = 0
'initializing value for use in for loop
For i = LBound(nums) To UBound(nums)
DBPrTot = DBPrTot + 10 ^ (nums(i) / 10)
'all of the values gathered from ParamArray are being input into this running total
Next i
DBADD3 = 10 * WorksheetFunction.Log10(DBPrTot)
'throwing the DBPrTot running value into our end equation
End Function
I'd like it to take an input like DBADD3(A1:A3,A5,A7) and still produce something. Can someone help?