PDA

View Full Version : Excel Formula help


Shaun
15th May 2009, 10:49 AM
In the excel sheet i have some sample betfair data, what i need to do is extract the favourite from each race can any one help with a formula to do this.

goty0405
15th May 2009, 11:11 AM
I haven't had time to look at your spreadsheet but a pretty simple way would be to do something like this:

Add a column called "Favourite"
Write a formula in tat column that gets the Minimum price of all runners, and then compare each runner's price to that. Something like this:
=IF(A1=(MIN(A$1:A$20)),1,0)

Where A1 = the price of the runner
A$1:A$20 is the series of prices of all runners

Put that formula in each cell in the Favourite column. That would put a 1 in the Favourite column if they are the favourite, or a 0 if they are not.

Shaun
15th May 2009, 11:38 AM
I can use formulas to extract this information in the below excel doc so now i need to get the fave from each race, i have listed 3 races here.

lomaca
15th May 2009, 11:50 AM
In the excel sheet i have some sample betfair data, what i need to do is extract the favourite from each race can any one help with a formula to do this.There is no simple formula, you will have to write a VBA script to loop through all the lines, select the course AND the race number starting from race one and then sort that group by price. If you use a select statement you can include the sort function into it.

You will need a double loop, first for the course, and an inner loop for the race number.

I haven't used VBA for many years, so I cant help you with that, the closest I can come with is VB which is similar, but I think someone out there is an Excel guru and will be faster, Chrome P maybe?

lomaca
15th May 2009, 01:06 PM
There is no simple formula, you will have to write a VBA script to loop through all the lines, select the course AND the race number starting from race one and then sort that group by price. If you use a select statement you can include the sort function into it.

You will need a double loop, first for the course, and an inner loop for the race number.

I haven't used VBA for many years, so I cant help you with that, the closest I can come with is VB which is similar, but I think someone out there is an Excel guru and will be faster, Chrome P maybe?On second thoughts, I suppose you could put a formula in a new column, that would compare the course and race number in the following record and until they are the same it would write the price in a cell if it is less then the cell before.
But you would have to make the comparison for the course and when the course name changes assign a new cell to write the smallest price into. It's a round-about way of what I said before, it might even work?

Chrome Prince
15th May 2009, 05:17 PM
For the purposes of simplicity, I'll explain, but you can record a macro afterwards to make it easy next time.

Data > Sort

By column E Ascending and H Descending

In column I2 =IF(B1&C1<>B2&C2,"favourite","")

Copy formula all the way down Column I

Favourite should be written in Column I for favourite, or blank if it's not.

Then you can Data Filter Autofilter and just select favourites from column I, or use a formula to add them up or whatever.

Shaun
15th May 2009, 06:50 PM
Thanks for all the help, i got it sorted over at Mr Excel if you look at the sheet below in the blue section you will see what i used.

Shaun
15th May 2009, 08:02 PM
How can i import this text doc to excel but delete the gaps between each line

Shaun
15th May 2009, 10:13 PM
Problem solved with a good text editor