Link to home
Start Free TrialLog in
Avatar of p_classic_2000
p_classic_2000

asked on

Calculate percentage

Hello,

I have a table "tbl2007_conference" with three fields, "NumberAttendees", "PresenterRating1" and "PresenterRating1_perc"

I'd like the percentage (PresenterRating1/NumberAttendees x 100) to be automatically calculated in the "PresenterRating1_perc" field. Any help would be greatly appreciated.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of rockiroads
rockiroads
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You should use queries to calculate and display data like this, rater than storing calculated data in your table.

SELECT *,   iif(NZ(NumerAttendees,0) = 0 , 0 ,100 * PresenterRating1/NumberAttendees) as PresenterRating1_perc
From tbl2007_conference

The iif should prevent divide-by-zero errors if NumberAttendees is 0.
Avatar of p_classic_2000
p_classic_2000

ASKER

Perfect, thanks rockiroads!
no probs
do think about not storing calculated values though, it may sound easy now but its more hassle than its worth