USe SUMPRODUCT() to count how many rows:
1) Total>current Total
If there are more than dupplicated same total, then next
2) Column (D-D1)/1000> current (D-D1)/1000
For example: row 3 and row 28, with same Total = 72
Row 3: current value = total - ABS(D-D1)/1000 = 72 - ABS(256-300) = 72 -0.044 = 71.956
Row 28: current value = total - ABS(D-D1)/1000 = 72 - ABS(576-300) = 72 -0.276 = 71.724
Now, there is only 1 row >= row 3, then row3 = 1
Now, there are 2 rows >= row 28, then row 28 = 2
That is how SUMPRODUCT works.
In P3:
drag down
Bookmarks