Getting % from two values that are counted. (1 Viewer)

rmsimps

New member
Local time
Today, 06:00
Joined
Apr 7, 2019
Messages
6
Want a Access Report that will do the following
Print each group, give the number attending for that group, give the number not attending for that group, and give the % attending.
Sample:
Groups Attending Dropped % Attending
1st Group 90 10 90%
2nd Group 18 6 75%
Each record has the group name and a check box for attending
I can get the following output, but I need to know how to get it in the format above with the % attending.

What I get now:
1st Group
90 Attending
10 Dropped

2nd Group
18 Attending
6 Dropped
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:00
Joined
Aug 30, 2003
Messages
36,118
Add attending plus dropped in a textbox and divide by attending.

=(Attending + Dropped) / Attending
 

rmsimps

New member
Local time
Today, 06:00
Joined
Apr 7, 2019
Messages
6
The formula would be
=Attending/(Attending + Dropped) * 100 to get the correct percent

Attending and Dropped are not variables however. They are generated by doing a count on the group. the words Dropped and Attending are generated from the following in a Text Control box. Attending is one of the fields in the table. It is a boolean check box.

=IFF([Attending] = True, "Attending", "Dropped")
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:00
Joined
Aug 30, 2003
Messages
36,118
Well, mine returns the "correct percent". Your version formats it which could also be achieved with a textbox format.

I was not thinking they were variables, I assumed they were field names on the report.
 

rmsimps

New member
Local time
Today, 06:00
Joined
Apr 7, 2019
Messages
6
If Attending = 75 and Dropped = 25 your formula would be
=(75+25)/75 which breaking it down would give (100) / 75 which = 1.3333....

My is: =75/(75+25) *100 = 75/100 * 100 = 75% which is correct answer. Unless access does not follow the rules of mathematics to calculate a percent.
 

Micron

AWF VIP
Local time
Today, 09:00
Joined
Oct 20, 2018
Messages
3,476
It all depends on what you want from the numbers and/or what you would do with them thereafter. 1.33333333333333 would be a viable result in some cases, as 100*1.33333333333333 = 75.0000000000002 . Access does follow the rules of math, but one can play with the output by using formatting. If you formatted the textbox to display % it would be the same as format(75/(75+25),"percent") which equals 75.00%
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:00
Joined
Aug 30, 2003
Messages
36,118
If Attending = 75 and Dropped = 25 your formula would be
=(75+25)/75 which breaking it down would give (100) / 75 which = 1.3333....

My is: =75/(75+25) *100 = 75/100 * 100 = 75% which is correct answer. Unless access does not follow the rules of mathematics to calculate a percent.

You're correct, I was focused on the addition of the "* 100". I had the numerator and denominator reversed.
 

Users who are viewing this thread

Top Bottom