I've just had a little mess around with this, and I was roughly right.
The LAY and BACK need to be the other way round so...
IF(ISNUMBER(Q5),"CLEAR",IF(U5>0,"LAY",IF(bet criteria here,"BACK","WAIT)))
and the bet criteria needs to include something that says profit/loss column must be zero otherwise you'll get another BACK placed after the LAY has been placed, etc, etc.
The formula above would go in cell N5. If your selection is on a different row then change all the 5's to whatever row your selection is in, and put the formula in column N of the same row.
Some suggestions for criteria to BACK the selection (if it were me) and how you would tell it to Excel....
Back odds lower than or equal to 1.5
F5<=1.5
Lay odds for same selection lower than or equal to 1.7 (I wouldn't want to back anything at 1.5 if no-one wanted to back it at 1.7)
H5<=1.7
No other horse is trading at below 4 (don't want to back short odds-on if anything's close to it!)
COUNTIF(F5:F50,"<4")<2
Just a quick note on the IF statement to show how it works. In plain English (or as close to it as you're gonna get from me!) it's saying...
If this is true, then do this, or else do this.
Or closer to what it looks like on the screen...
IF(this is true , do this , or else do this)
Our formula looks a little more complicated because there are IF's buried in IF's, but you'll soon get the hang of it.
The COUNTIF that I've used above means...
Look at the numbers in the cells from F5 to F50 (I've used 50 because there won't ever be any more than this, and blank cells don't matter) and tell me how many are below 4. In our case we want there to be less than 2 at under 4, in other words, just our selection.
ISNUMBER means just that. Does the cell in the brackets contain a number. That is there because the only time that column Q contains a number is when a bet has been placed, which is exactly what we want to know.
The only other function this will use is AND, and that will be part of your bet criteria because you have multiple things you want to be true before you place the bet.
For example....
AND(condition1, condition2, condition3, condition4) will only be TRUE if ALL of the criteria are TRUE. If only one of them is FALSE then the whole thing will give a value of FALSE.
I hope that makes some kind of sense, and helps you to understand this....
=IF(AND(ISNUMBER(Q5),U5=0),"CLEAR",IF(U5>0,"LAY",IF(AND(F5<=1.5,H5<=1.7,COUNTIF(F5:F50,"<4")<2,U5=0),"BACK","WAIT")))
Just had another play with this longer version and it DOESN'T WORK - PLEASE DON'T USE IT!!
I'm still going to post it though because it
might help people make their own formulae up, or at least to understand a little what is going on when other people post.
The problem with mine appears to be one of timing.
Anyone who does their own formula and wants to play around with it just put it in N5 on a blank sheet without BA entering data and make some odds up in column F, then fill in what would happen if BA were interacting with it and you'll see what I mean.
Because of the in-play delay the p/l column will still be 0 when the reference is cleared, so another BACK will get placed.
Please post if anyone finds a way around it.
Alternatively, learn VBA

Anyone who did any sort of BASIC language at school or wherever will pick it up very quickly (am I showing my age now?)