Custom Function-sum based on multiple criteria

R

Rachel

I have created a custom function that sums one range of
cells based on criteria in another range:

dblIBilling = Application.WorksheetFunction.SumIf
(OwnerRange, employee, BillingsRange)

Now I need to add two additional criteria from a different
range.

In essence:
Sum "BillingsRange" if "OwnerRange" = employee's name (the
part I already have)
AND
"UnitsRange" = "Hour" or "Over".

I'm sure this can be done, and I've tried multiple options
but I'm not getting it.

Any advise would be appreciated!
Rachel
 
T

Tom Ogilvy

This would require an array formula which you can not really use in VBA
directly. (sumproduct won't work in this instance either).

You could set up the formula and use Evaluate to return the value, but it
would need a string set up the same way you would enter it in a cell.

Otherwise, you need to loop through you range and check for the appropriate
conditions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top