CountIF, SumIF similar function

  • Thread starter Thread starter Rohit Thomas
  • Start date Start date
R

Rohit Thomas

Hello All,

I am trying to sum and count specific records in a report
that I am creating. Are the DSum and DCount functions
similar to those of the CountIF and SumIF functions found
in Excel. I would like to sum a field [Correction ID] if a
corrsponding field [Credit or Debit] equals 'C'. The same
applies for the count function. The underlying query in
the report changes through code so I am not sure how to
use the DSum and DCount functions. Can someone show me
which function I need to use to get the result I am
looking for.

Thanks in advance,
Rohit Thomas
 
This most efficient method to count or sum values based on conditions is
like:
To count:
=Sum(Abs([Your Condition]))
To sum a field like Qty:
=Sum(Abs([Your Condition]) * [Qty])
You can also use multiple conditions:
=Sum(Abs([Gender]="M" And [DOB] < #1/1/1960#) * [Wages])

DCount and DSum should not be used if your "domain" is the same as the
report's record source.
 
Duane,

Thanks for your reply and the explanation of the
functions.

Rohit
-----Original Message-----
This most efficient method to count or sum values based on conditions is
like:
To count:
=Sum(Abs([Your Condition]))
To sum a field like Qty:
=Sum(Abs([Your Condition]) * [Qty])
You can also use multiple conditions:
=Sum(Abs([Gender]="M" And [DOB] < #1/1/1960#) * [Wages])

DCount and DSum should not be used if your "domain" is the same as the
report's record source.

--
Duane Hookom
MS Access MVP
--

Hello All,

I am trying to sum and count specific records in a report
that I am creating. Are the DSum and DCount functions
similar to those of the CountIF and SumIF functions found
in Excel. I would like to sum a field [Correction ID] if a
corrsponding field [Credit or Debit] equals 'C'. The same
applies for the count function. The underlying query in
the report changes through code so I am not sure how to
use the DSum and DCount functions. Can someone show me
which function I need to use to get the result I am
looking for.

Thanks in advance,
Rohit Thomas


.
 
Back
Top