Conditional Summing

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that I use in Datasheet view as a subform. The form has
several calculated fields in it's footer using the sum command.

This works fine, but what I need to do is only sum the records where a
certain field is set to true.

How can I do this?
 
Svetlana said:
Use DCount function for it.

DCOUNT only counts the number of records. The field I am summing on is numeric. If only two records meet the true validation then Dcount would return 2, but I want a total. The field I am summing on might equal 3 in the first record and 6 in the second so the value I want returned is 9
 
Keith said:
I have a form that I use in Datasheet view as a subform. The form has
several calculated fields in it's footer using the sum command.

This works fine, but what I need to do is only sum the records where a
certain field is set to true.

How can I do this?

You could use a controlsource expression (in the form footer) like

=Sum(IIf([BooleanField]<>0, [AmountField], 0))
 
Back
Top