1
$\begingroup$

I have a like button and a dislike button. I want to quickly display in a percentage format how much people like it, -100% being everyone dislikes and 100% being everyone likes.

What would be the math forumula to find this percentage.

Say 100 people like it and 50 people hate it.

Would it be something like

100 + 50 / 2 ?

Thanks! Jeff

$\endgroup$
3
  • $\begingroup$ How about #likes/total ? So your case would be $\frac {100}{150}=66.66\dots \%$ $\endgroup$ – lulu Aug 21 '18 at 20:08
  • $\begingroup$ @lulu: that gives $0$ when everyone dislikes, not $-100\%$ $\endgroup$ – Ross Millikan Aug 21 '18 at 20:14
  • $\begingroup$ @RossMillikan Ah, true. $\endgroup$ – lulu Aug 21 '18 at 20:17
1
$\begingroup$

You can use $$\frac {likes-dislikes}{likes+dislikes}$$

$\endgroup$
1
  • $\begingroup$ In other words, the average value of a vote, where a like is worth $1$ and a dislike is worth $-1$. $\endgroup$ – Jack M Aug 21 '18 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.