I've been creating a lot of budget templates lately and I'd like to create a user-defined function to more easily handle how a capped payroll tax works.
In the past I've used the following array formula to find this amount:
{=SUM(IF(Range<Cap,Range,Cap))*Rate}
(example also attached)
I'm hoping to create a user-defined function so that I can just select the range, the cell containing the cap amount, and the cell containing the tax rate to easily produce the total amount of the payroll tax, but I'm not quite sure what VBA code to use to achieve this.
Any help would be much appreciated!
Bookmarks