How to convert SumProduct function in VBA code ?

W

Wellie

I'm using the the following "sumproduct" excel function in the spreadsheet.

=SUMPRODUCT(--(A1:A2762=Acct_ID),--(F1:F2762=Metric_Name),--(G1:G2762))

It basically check data in colu,m A & F. If they meeting criteria stored in
cell "Acct_ID" and "Metirc_Name", it sums data in column G.

Can someone please tell me how can I convert the "sumproduct" function as
shown above to VBA code in subroutine similar to the the following 'subtotal'
function ?
With Application
SumVal = .Subtotal(9, Rng.Columns("H"))
end With
 
B

Bob Phillips

Simplest way

Sumval =
Evaluate("SUMPRODUCT(--(A1:A2762=Acct_ID),--(F1:F2762=Metric_Name),--(G1:G27
62))")

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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