View Full Version : counting calculations


chrisl
11-05-2001, 09:37 AM
I am new with access and need a bit of help with a report. Is there a way to count 2 different values within a field and then divide it by the total number of records in the report (which is generated by another field) so that a percentage may be obtained?
Any help is appreciated.

charityg
11-05-2001, 10:04 AM
Why are you storing two different values in the same field????? Big no no.

If the values were in two separate fields, you can use a query to define a field as

Avg1:Sum(field1)/Count(ID)

Avg2:Sum(field2)/Count(ID)

chrisl
11-05-2001, 10:57 AM
Thank you for the feedback Charity. The field is a drop down menu with 4 different values to choose from. Is this bad design?

Pat Hartman
11-05-2001, 12:50 PM
No, that is correct. I think that Charity interpreted the question differently.

You can use something like the following in your controls:

first control:
=Sum(IIf(YourField = "value1", 1, 0))
Second control:
=Sum(IIf(YourField = "value2", 1, 0))
third control:
=Sum(IIf(YourField = "value1", 1, 0))/ Count(*)
fourth control:
=Sum(IIf(YourField = "value2", 1, 0))/ Count(*)

chrisl
11-09-2001, 11:35 AM
Pat,

I really appreciate your reply. I will give your suggestion a try and let you know how it goes.

Thank you,
christine

[This message has been edited by chrisl (edited 11-09-2001).]