View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default vba and conditional totalling ... WorksheetFunction SumIf ?

=SUMPRODUCT(--(A2:A100=--"2005-06-01"),--(A2:A100<=--"2005-06-30"), --(F2:F
100="Cleared"),D2:D100)

which gives total amount for Cleared items in June.

To do this in VBA, use

myTot =
evaluate("SUMPRODUCT(--(A2:A100=--""2005-06-01""),--(A2:A100<=--""2005-06-3
0""), --(F2:F100=""Cleared""),D2:D100)")

--

HTH

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


"SA3214 @Eclipse.co.uk" <sa3214<No Spam wrote in message
...
I am not sure if SumIf is the correct function to use ....

I have a worksheet containing the following

Column A = Date
Column D = Amount (+ve and -ve values to represent Debits and Credits)
Column F = Status ("Cleared" or "Not Cleared")

I would like to display, on a userform, various totals e.g.

Between a range of values in column A, the sum of negative values in

Column
D that have the status "Cleared" in Column F.

If you could let me have the code for this calculation, hopefully, I can
edit it to produce similar sub totals

Regards and TIA