SQLite Forum

Get column rank from values in selected row
Login
I'd like to help more, but honestly I'm at a loss what you are trying to do or achieve with the math. Taking your word the math is correct, I'm still unsure of what the problem or intended use/result is.

I think it's a typical type of problem where the result/answer is to clear to you because your mind has been involved with it intimately for a while now and the problem definition is second nature to you by now, but none of us know what you really need or why you need it, so it's all guessing.

If you give an example table with clear columns, and a definition of what you need from it and an example result that would be correct (with enough example rows to ensure only one interpretation of the query can work), we can help make that Query happen - but I'm afraid the current definition is hard to follow.

One example, quoting you:
 
> Still, not quite right as I can see still relatively big centile differences with small provided values differences.

Why are big centile differences wrong? Different to what? Should it not be? Why not? Are the calcs working correctly when not in a query? What small value differences? Provided how and why??   
You may as well have told us that you are on duty because the train station near you blew its left drum again.  It raises very many more questions than it answers.