I'm not looking to have this made (yet), but would like to know whether it is possible to setup the following (in a better way than I'm attempting):

I want something that will tell me the probability of each horse finishing in X place based on its price in the win market for any given race.

I've been able to code one that provides probabilities for 2nd place, but want to check if there are other/more efficient ways of achieving this, as calculating 3rd/4th/etc requires substantially more iterations than calculating 2nd (I'm having to calculate iteratively as the number of horses per race varies).

Output required would simply be variable value (e.g. so 'toptwo' would return the probability of finishing in top 2 places, 'topthree' the top 3 place probability, up to at least 4 places and preferably up to 6).

Could such a trigger be made either to operate non-iteratively and/or to do the relevant calculations externally in excel?

The relevant maths can be found here:

https://math.stackexchange.com/questions/864823/place-show-and-unordered-horses-forecast-probability-calculation