Forums

General Betting

Welcome to Live View – Take the tour to learn more
Start Tour
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.
Pause Switch to Standard View excel experts help
Show More
Loading...
Report Compound Magic October 5, 2010 5:22 PM BST
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.
Report Compound Magic October 5, 2010 5:41 PM BST
Slight correction to formula I left out the dollar sign before each 200

=AVERAGEIF(A$1:A$200,A1,B$1:B$200)
Report Deltâ October 5, 2010 5:56 PM BST
blimey, a spreadsheet to work out the Hanagan winnings - respect!
Report MANCHESTERSKYTRAIN October 5, 2010 5:57 PM BST
thanks will tell her to try it, cheers m8
Report MANCHESTERSKYTRAIN October 6, 2010 8:25 AM BST
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
Report IanP October 6, 2010 8:57 AM BST
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.
Report IanP October 6, 2010 9:09 AM BST
Make that =COUNTIF(A$1:A$200,A$1:A$200) or =COUNTIF(A$1:A$200,A1)
Report Compound Magic October 6, 2010 9:18 AM BST
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
Report MANCHESTERSKYTRAIN October 6, 2010 9:57 AM BST
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
Report Compound Magic October 6, 2010 10:08 AM BST
There is no MEDIANIF()in excel you can manipulate median Using MEDIAN(IF(.....

Just use the formula in my last post much easier
Report MANCHESTERSKYTRAIN October 6, 2010 10:15 AM BST
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
Report Escapee October 6, 2010 1:16 PM BST
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 ?
Report Compound Magic October 6, 2010 1:16 PM BST
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.
Report Compound Magic October 6, 2010 1:50 PM BST
Escapee try in cell C2 and fill down

=IF(A2=A3,"",SUMIF(A$2:A2,A2,B$2:B3))
Report Compound Magic October 6, 2010 1:59 PM BST
Escapee error correction
=IF(A2=A3,"",SUMIF(A$2:A2,A2,B$2:B2))
Report Escapee October 6, 2010 2:17 PM BST
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.
Report top2rated October 6, 2010 2:31 PM BST
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
Report Escapee October 6, 2010 2:47 PM BST
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 ?
Report Compound Magic October 6, 2010 2:51 PM BST
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))
Report Escapee October 6, 2010 2:55 PM BST
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
Report Compound Magic October 6, 2010 3:05 PM BST
Ok getting there

Try =IF(DAY(A2);=DAY(A3);"";SUMIF(A$2:A2;A2;B$2:B2))
Report Compound Magic October 6, 2010 3:07 PM BST
Full of errors today
should be
=IF(DAY(A2)=DAY(A3);"";SUMIF(A:A2;A2;B$2:B2))
Report Escapee October 6, 2010 3:24 PM BST
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.
Report Compound Magic October 6, 2010 3:32 PM BST
I stuffed up again
=IF(DAY(A2)=DAY(A3);"";SUMIF(A$2:A2;A2;B$2:B2))
Report Escapee October 6, 2010 3:53 PM BST
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
Report Escapee October 6, 2010 4:09 PM BST
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
Report Compound Magic October 6, 2010 5:03 PM BST
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.
Report Escapee October 6, 2010 5:04 PM BST
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 ?
Report Compound Magic October 6, 2010 5:07 PM BST
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.
Report Escapee October 6, 2010 5:31 PM BST
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 ?
Post Your Reply
<CTRL+Enter> to submit
Please login to post a reply.

Wonder

Instance ID: 13539
www.betfair.com