You can do it using VBA.
You can also do it using only formulas in clmn Q but is complicated
Placing a second bet in the same horse and avoiding falling into a loop is what you need to pay attention
I posted a file few days earlier that does a "similar" thing, take a look but it must be modified a lot
viewtopic.php?f=5&t=11635