View Full Version : Simple Rating Calculation

phantom007

07-16-2009, 06:23 AM

Hi There,

I am sure you have seen in many sites there are rating system. So, you can rate a product out of 5 or 10.

Does someone knows the formula for displaying the rating result?

Suppose, I have rated a product 3 out of 5 and the total number of votes is 1500 for that product. What will be the actual rating for that product?

Thanks in advance :)

primefalcon

07-16-2009, 08:03 AM

I suppose its an average score, there 2 ways to do it

first way is

keep a count of the total number votes cast, as you said 1500, now you assuming a voting mechanism between 1 and 5 for each persons vote add the number to the total voted score tallied thus far, say there's a total score of 6400 with max so far being 7505, with your vote and 7500 without your vote. you gave it a 3 however giving a total score of 6403, so divide that by 1501(votes cast) and that gives you an average of 4.265822785 which rounded gives you 4.3 or just an average of 4 if you round to a whole number.

The other way is to keep a tally of every single vote, and add all the votes together and devide them by number of people voted.

It kinda depends on how much info you want to store and how much processing you want to do. Process wise the first method is better.

phantom007

07-16-2009, 08:12 AM

4.265822785

4.265822785 ??

How did you get that #?

1501 / 5 = 300.2

Kindly explain

Thanks

primefalcon

07-16-2009, 08:18 AM

4.265822785 ??

How did you get that #?

1501 / 5 = 300.2

Kindly explain

Thanks

Sorry I meant divide the total tallied score by number of votes so 6403/1501.

I've corrected that above, I actually had it right first, messed it up though when I was correcting typo's, sorry about that.

phantom007

07-16-2009, 08:52 AM

Works!

Thanks

primefalcon

07-16-2009, 10:17 AM

Your welcome :-)

Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.