Forums

General Betting

There is currently 1 person viewing this thread.
MANCHESTERSKYTRAIN
05 Oct 10 16:57
Joined:
Date Joined: 11 Mar 02
| Topic/replies: 1,780 | Blogger: MANCHESTERSKYTRAIN's blog
wife is doing a spreadsheet , she has 2 columns
column A is the date and the same date may have 100s numerical values entries in column B, she wants in column C to average all values in B that correspond to the sme date in column A, what formula would she need to give this average on all the rowas corresponding to each individual date, or can this not be done? thanks.

Post your reply

Text Format: Table: Smilies:
Forum does not support HTML
Insert Photo
Cancel
sort by:
Show
per page
Replies: 30
By:
Compound Magic
When: 05 Oct 10 17:22
Copy and paste this in C1

=AVERAGEIF(A$1:A200,A1,B$1:B200)

Change the 200(both) in the formula to how many rows you have.
Fill down the formula for how many rows you have.
By:
Compound Magic
When: 05 Oct 10 17:41
Slight correction to formula I left out the dollar sign before each 200

=AVERAGEIF(A$1:A$200,A1,B$1:B$200)
By:
Deltâ
When: 05 Oct 10 17:56
blimey, a spreadsheet to work out the Hanagan winnings - respect!
By:
MANCHESTERSKYTRAIN
When: 05 Oct 10 17:57
thanks will tell her to try it, cheers m8
By:
MANCHESTERSKYTRAIN
When: 06 Oct 10 08:25
CM thanks, my wife used the formula
=AVERAGEIF(A$1:A$200,A1,B$1:B$200)
and #NAME? was returned in each cell
strangly if she changed the formula to
=SUMIF(A$1:A$200,A1,B$1:B$200)
it then worked perfectly in totaling the values corresponding to each individual date
Do you have any ideas why it wont work for her with the AVERAGE?
Very frustrating as would solve a problem of manually averaging and inputting values for each date.
cheers
By:
IanP
When: 06 Oct 10 08:57
Averageif probably wasn't available in the version of excel she is using.  She could have another column =COUNTIF(A$1:A$200,B$1:B$200)
and then a third column dividing the result into the SUMIF column.
By:
IanP
When: 06 Oct 10 09:09
Make that =COUNTIF(A$1:A$200,A$1:A$200) or =COUNTIF(A$1:A$200,A1)
By:
Compound Magic
When: 06 Oct 10 09:18
As Ian said you probably have an earlier excel version that does not support AVERAGEIF
If you have an earlier version ~ this formula will do the same thing as AVERAGEIF
=SUMIF(A$1:A$200,A1,B$1:B$200)/COUNTIF(A$1:A$200,A1)

Cheers
By:
MANCHESTERSKYTRAIN
When: 06 Oct 10 09:57
Excellent now is there a way of retreiving MEDIANIF from the same data in excel 2003?
i have had a look on google can't find a solution, thought i would pick your brains, thanks
By:
Compound Magic
When: 06 Oct 10 10:08
There is no MEDIANIF()in excel you can manipulate median Using MEDIAN(IF(.....

Just use the formula in my last post much easier
By:
MANCHESTERSKYTRAIN
When: 06 Oct 10 10:15
she is concerned that a couple of extreme values could make increase the average and not be a true representation, so that is why she is hoping to use median as well to see which works better, is there no way of getting the median in this example?
cheers
By:
Escapee
When: 06 Oct 10 13:16
Hi there, I have a similar problem to MANCHESTERSKYTRAIN's except I'm working with OPEN OFFICE not EXCEL


I Have a table like this and I want to be able to total up the result of each days bets in Column C
  A                       B            C           
    09/07/10        7.89           
    09/07/10        -3.5           
    09/07/10        -18.4           
    09/07/10        25.46           
    09/07/10        -27.2           
    09/07/10        29.93    (Days Total Here)
    10/07/10        7.91           
    10/07/10        -5.85           
    10/07/10        -12.96    (And Here)   
    11/07/10        -4.26           
    11/07/10        -4.48           
    11/07/10        10.69           
    11/07/10        -32           
    11/07/10        -9.92    (And Here)   


I've tried entering the formula =SUMIF(A2:A15;A2;B2:B15) in Cell C2 but it does not seem to operate as people are suggesting it operates in EXCEL.  ( it appears to be summing up the whole B column reagardless of the date )


Anyone got any ideas on how to do this in OpenOffice ?
By:
Compound Magic
When: 06 Oct 10 13:16
I only know of 2 ways to do what you want.
As it requires an array formula the easiest way is to
find 2 empty cell at the top of your spreadsheet lets say E1 and F1 are vacant cells
in E1 enter the date you wish to know the median of and in Cell F1 enter this formula
=MEDIAN(IF(A1:A200=E1,B1:B200))
Select F1, Click in the formula bar so the insertion point is blinking and then~
To enter the array formula, with the shift and control keys held down press enter.
You only have to do that the one time. that is where your answer will be. just change the date
in E1 to see what the median is for that date.

If you really need the answers in Column C on the same rows as the date, one way is to write a function macro.
There is probably other ways to do this but I don't know, someone more expert than me might be able to help.
By:
Compound Magic
When: 06 Oct 10 13:50
Escapee try in cell C2 and fill down

=IF(A2=A3,"",SUMIF(A$2:A2,A2,B$2:B3))
By:
Compound Magic
When: 06 Oct 10 13:59
Escapee error correction
=IF(A2=A3,"",SUMIF(A$2:A2,A2,B$2:B2))
By:
Escapee
When: 06 Oct 10 14:17
Compound

=IF(A2=A3,"",SUMIF(A$2:A2,A2,B$2:B2))


That's give an Err:508 which according to the 'help' is: Missing Brackets

And there appears to be no missing brackets in that there are 2 opening and 2 closing.


Searching the 'help' for the '$' gives no results and not sure what the Open Office equivilent to '$' is.
By:
top2rated
When: 06 Oct 10 14:31
Escapee

I needed something similar and Compound Magic's tip works a treat.....

    05/10/10        -15.25           
    05/10/10        22.50           
    05/10/10        18.95        41.45   
    04/10/10        12.17           
    04/10/10        -32.25           
    04/10/10        -27.00           
    04/10/10        14.75           
    04/10/10        16.25        -16.08   
    03/10/10        -45.00        -45.00   
    02/10/10        18.35           
    02/10/10        16.50           
    02/10/10        11.89        46.74   
    01/10/10        13.00           
    01/10/10        -19.85           
    01/10/10        14.31        7.46   


Don't forget to change , to ; for open office. Happy
By:
Escapee
When: 06 Oct 10 14:47
Compound and Top2rated

Thanks... I'm getting there, I had just managed to work out the , and ; switch when Top2Rated posted Laugh

Problem I getting now is that it's summing up for each race instead of each day.

In column 'A' I have a date "09/07/2010 15:00:00" which I then 'Format Cells' to "09/07/10"

but it appears that the =IF(A2=A3... is still seeing the time portion of the date and hence summimg at the race level instead of the day level.

Any neat shortcuts to remove the time portion of the date ?
By:
Compound Magic
When: 06 Oct 10 14:51
The $ sign before a cell row or cell column signifies an absolute address without the $ sign means it
is a relative reference.

The formula works for me in open office 3.2.1 and I am sure it should work in earlier versions
Try entering This formula in just cell C2 and see if it comes up with an error
=SUMIF(A$2:A2,A2,B$2:B2)
Now try
=IF(A2=A3,"",2) and see if that comes up with an error
If those are error free retry
=IF(A2=A3,"",SUMIF(A$2:A2,A2,B$2:B2))
By:
Escapee
When: 06 Oct 10 14:55
I appreciate your Help Compound it was the Comma's causing the error508 not the $

Any tips on getting the =IF(A2=A3... to ignore the time portion of the date ?


Many thanks again
By:
Compound Magic
When: 06 Oct 10 15:05
Ok getting there

Try =IF(DAY(A2);=DAY(A3);"";SUMIF(A$2:A2;A2;B$2:B2))
By:
Compound Magic
When: 06 Oct 10 15:07
Full of errors today
should be
=IF(DAY(A2)=DAY(A3);"";SUMIF(A:A2;A2;B$2:B2))
By:
Escapee
When: 06 Oct 10 15:24
I've got =IF(DAY(A2)=DAY(A3);"";SUMIF(A$2:A2;A2;B$2:B2))

Which differs from your last formula ( as bolded )

and it's producing totals at the expected place in column 'C' but the actual figures are incorrect. ( i.e. don't tally with the test figures I have manually generated using SUM( A2:A38 ) ( which is one days bets ).

I still haven't managed to get my head completely round the absolute/relative addressing thingy of the $ symbol and how it works.
By:
Compound Magic
When: 06 Oct 10 15:32
I stuffed up again
=IF(DAY(A2)=DAY(A3);"";SUMIF(A$2:A2;A2;B$2:B2))
By:
Escapee
When: 06 Oct 10 15:53
This is what I'm getting ( with the expected manually generated results in the last column )
A            B    Expected Result
1 09/07/10    7.89   
2 09/07/10    -3.50   
3 09/07/10    -18.40   
4 09/07/10    25.46   
5 09/07/10    -27.20   
6 09/07/10    29.93     2.73     14.18
7 10/07/10    7.91   
8 10/07/10    -5.85   
9 10/07/10    -12.96   
10 10/07/10    7.91   
11 10/07/10    -5.83    2.08        -8.82
12 11/07/10    -4.26   
13 11/07/10    -4.48   
14 11/07/10    10.69   
15 11/07/10    -32.00   
16 11/07/10    -9.92    -9.92        -39.97




I have this in Cell C1 =IF(DAY(A1)=DAY(A2);"";SUMIF(A$1:A1;A1;B$1:B1))

which is then 'filled' down to cell C16  =IF(DAY(A16)=DAY(A17);"";SUMIF(A$1:A16;A16;B$1:B16))


I'm obviously using the $ incorrectly in the SUMIF(... section
By:
Escapee
When: 06 Oct 10 16:09
I can see now that it is only SUMming up the last record of the day and the one prior to it.

i.e. lines 5 and 6: -27.20 + 29.93 = 2.73
lines 10 and 11: 7.91 + -5.83  =  2.08

and line 16 doesn't seem to add up with line 15 and is = -9.92 ??




so close and yet so far
By:
Compound Magic
When: 06 Oct 10 17:03
Ive got it sussed the $ sign is okay the problem is the hidden part of the date changing values (the time part) So a
new formula Must go in cell C2 and fill down
=IF(DATE(A2)=DATE(A3);"";SUMIF(D$2:D2;D2;B$2:B2))
Now in Cell D2 this formula ~ you can hide this column if it bothers you once formulas are entered.
=LEFT(VALUE(A2),5)
Format column D as numbers
Now fill down ~ that is cutting the time of that is hidden which is stuffing everything up.
By:
Escapee
When: 06 Oct 10 17:04
Further testing and hair pulling has revealed that is does indeed work as expected if I manaually delete the time portion of the date LaughCry


So it would seem the IF( (DAY(A1)=DAY(A2)  is correctly detecting the change of day and ignoring the time portion

but for some reason the SUMIF(A$1:A1;A1;B$1:B1) is not ignoring the time portion of the bet and hence only adding up bets for the last race of each day.


back to pulling my hair out to work out why.


Any suggestions anyone ?
By:
Compound Magic
When: 06 Oct 10 17:07
Forget last post this is the real deal!!!!! Its 3am here and i'm making errors

Ive got it sussed the $ sign is okay the problem is the hidden part of the date changing values (the time part) So a
new formula Must go in cell C2 and fill down
=IF(DAY(A2)=DAY(A3);"";SUMIF(D$2:D2;D2;B$2:B2))
Now in Cell D2 this formula ~ you can hide this column if it bothers you once formulas are entered.
=LEFT(VALUE(A2),5)
Format column D as numbers
Now fill down ~ that is cutting the time of that is hidden which is stuffing everything up.
By:
Escapee
When: 06 Oct 10 17:31
Thankyou Thankyou Thankyou

It does indeed work ( except for the comma in LEFT(.... )



I had just got there myself in a similar way by using an intermediate column H and setting with  =DAY(A1) and then ammending the SUMIF to
=IF(H1=H2;"";SUMIF(H$1:H1;H1;B$1:B1))


Thanks again for all your help Compound.



Seems a lot of faffing about, Does Excel require a dummy column or can you just use the "format cell" and forget the dummy column ?
sort by:
Show
per page

Post your reply

Text Format: Table: Smilies:
Forum does not support HTML
Insert Photo
Cancel
‹ back to topics
www.betfair.com