I uploaded the file so basically formula should look into column a first example it would look into A2:A12 because its one race with 11 horses it should into if AR2:AR11=1 and BT2:BT11<3 and it should the same time look if in the same race Power 2 AR2:AR11= 2 AP2:AP11<3 and BT2:BT11<3 then bet on A8 which is POWER 2 AR8=2 so it means if horse which is ranked by power 1 AR2=1 but Draw rank is more then 3 and 2nd Power ranked horse in column AR2 =2 and spend and draw ranks are less then 3 then it should bet on Power 2 horse it should look into unique value in A:AA if that makes sence
pic:
https://imgur.com/a/HU4JJ
file:
https://www.sendspace.com/file/1isig1
pic:
https://imgur.com/a/HU4JJ
file:
https://www.sendspace.com/file/1isig1