# How to remove a rating of vendor based on an insertion calculation

I am currently inserting a star rating of various vendors using the following formula New

New Rating Value = ((Overall Rating * Total Rating) + New Calculated ) / Total Rating


where

   Overall Rating = Current Rating value
Total Rating   = No of reviews (ratings) currently present
New Calculated = The new star rating value the user specified


The above formula works for adding a new rating. My question is how would I remove a specific rating and return to the old value if I only have the New Calculated and the total Rating value (I wont have access to the earlier Overall Rating ?

• I think you want to ask this question on stackoverflow – saulspatz Jun 29 '18 at 23:32

If I understand correctly you have $$\frac {O\times T+N_c}T=N_r$$ yes?
Then, if you are given $N_r,N_c,T$ we get $$O=\frac {N_rT-N_c}T$$
Note: I am not entirely clear on the definition of $T=$ Total Rating. How is it the same even after you add a new rating? Shouldn't it have increased by $1$? Usually when you add a new element to a sample and seek to compute the new average given the old, you take into account that the sample size has increased by $1$.
• $N_r$ is what you call New Rating Value. If you don't have that (or some equivalent information) then you can't extract the old rating My point is that, in your formula, I think the denominator ought to be $T+1$. – lulu Jun 29 '18 at 23:41