Dividing two number in a query...HELP

message from RichK on 05 May 2004
I have a query that returns 2 values that are sums.

I need to divide these two numbers and show the results in the query.

One field is the sum of service calls made and the other is the sum of the
dollars generated by those calls. I need to divide them for an average cost
per call.

Thanks in advance for any help !

Rich K
 
=?Utf-8?B?QmVySGF2?= replied to RichK on 5 May 2004
Hi Rich,

Average: (sum of calls) / (sum of dollars)

HTH,
Bernd
 
=?Utf-8?B?QmVySGF2?= replied to =?Utf-8?B?QmVySGF2?= on 5 May 2004
Sorry, other way around, of course ;-)

Average: (sum of dollars) / (sum of calls)

(Sum of dollars) and (sum of calls) should be your 2 fields containing the figures.

Average: will be the new/third field name (= label)

Bernd
 
Dirk Goldgar replied to RichK on 5 May 2004
"RichK" <me@home.com> wrote in message
news:A48mc.143548$Gd3.34154560@news4.srv.hcvlny.cv.net

Assuming your query is already a totals query, so that you can get
Sum(ServiceCalls) and Sum(Dollars), then you can have a third calculated
field:

CostPerCall: IIf(Sum(ServiceCalls)=0, 0, Sum(Dollars) /
Sum(ServiceCalls))

The IIf function is used to avoid an error if there were no calls.
 

Archived message: Dividing two number in a query...HELP (Microsoft Access Forms)