Help Needed with nested (I think!) formula please

Hi there. This is my first post on the forum so I do hope I'm following all the protocols correctly. I would really appreciate some help as my brain is almost worn out from trying to sort out this formula!

I'm using an Excel spreadsheet to analyse data for horse racing results.

I've come across a problem, which I thought I had a formula for, but
in real life it's falling short of what I need - I've obviously done something too simplistic.

In the attached spreadsheet, the columns I am interested in are L & M - Price differences (expressed in decimal betting odds) from the preceding horse and the following horse in the race. What I have done all looks ok until we get the issue of JOINT favourite horses where the BSP (that is the starting price in column O) is the same for 2 or more horses in the same race). I have highlighted an example of this in green -
rows 82 and 83. Sometimes there may be 3, 4 or even more joint favourites in a race. When this occurs I would need to see the columns L & M being identical for all the joint favourites in the race. So in this example, in column L it should read 5.01 for both Black Baccara and Dorothys Dancing and in column M it should read 9.74 for both these horses.

I do hope this makes sense and that someone can put me out of my misery!

Thanks
Juliet

AttachmentSize
Price_Disparity_Prec_Foll.xlsx32.96 KB
Vishesh's picture

Put this formula in Cell

Put this formula in Cell L3
=IF(COUNTIF($O$3:$O3,O3)>1,L2,IF(C3=1,0,O3-O2))

and drag it down to the last cell in the same column.

It ALMOST works!!

Hi Vishesh - thank you very much for your response and for working on this for me - it almost works!

Unfortunately some of the horses now have the same Price Diff from Prec (Column L) where they shouldn't - for example this has happened in rows 33 & 34, 47 & 48 and some others.

Only where the number in Column C favourites matches the previous row (and therefore Column O BSP also matches) should figures in Column L match.

Thanks again for your help and if you're able to fix this that would be really great.

Vishesh's picture

Modified

Modified formula...

=IF(AND(COUNTIF($O$3:$O3,O3)>1,C3=C2),L2,IF(C3=1,0,O3-O2))

Many thank

Many, many thanks Vishesh - works great!