View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
ALEX ALEX is offline
external usenet poster
 
Posts: 493
Default vba and conditional totalling ... WorksheetFunction SumIf ?

hi,

the formula works with only 1 argument for the date - A2:A100=--"6/01/2005"
- i cant put in the second part.

could you please post the function as you have it again.

Thanks,

Alex

"SA3214 @Eclipse.co.uk" wrote:

Bob,
Many thanks for the swift response,
What you suggested is a start .... but it evaluates the total of all cleared
payments (both +ve and -ve).
Would you mind editing it to produce the sum of either +ve or -ve ... I'm
not sure I am upto it.

Regards
.....................................

"Bob Phillips" wrote in message
...
=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