Replicate SUMPRODUCT in VBA to create UDF which is much shorter to simplify appearance of formulae

Robnrolla

New Member
Joined
Jul 16, 2017
Messages
13
Hello,

I would like to know how to create a UDF in VBA that replicates a SUMPRODUCT formula. Is this possible and how can I do it? I am new to VBA so not familiar enough with the code to create this myself.

For example - UDF - HO() = SUMPRODUCT((Item Index range=X)*(Date Index Range=Y)*(Numbers Range))

Thanks,

Rob
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hello,

You should take a look at Evaluate ... in order to work ou the result of your Sumproduct formula ...

Hope this will help
 
Upvote 0
is somethign like this what you are looking for:
Code:
Function ho(r1 As Range, r2 As Range, r3 As Range)
 ho = Application.WorksheetFunction.SumProduct(r1, r2, r3)
End Function
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,496
Messages
6,113,995
Members
448,539
Latest member
alex78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top