+ Reply to Thread
Results 1 to 2 of 2

Conditional averaging formula using arrays?

  1. #1
    Forum Contributor
    Join Date
    11-11-2011
    Location
    London England
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    157

    Question Conditional averaging formula using arrays?

    Hi,

    It's been a while since I've used Excel (for Mac 2004) to anything too complicated and I'm trying to put together a Sports Ranking for NHL teams (almost just to see if I can do it - running a little bit of statistical analysis on it etc.).

    Basically I'm quite convinced I have the right formula but I've got to have used the wrong function slightly as it's displaying the wrong result on screen if that makes sense (calculator shows something that looks roughly like the right figure but it is not displaying it in the right cell).

    Basically first I grabbed a load of scores for the season to November 8th and pasted them in an appropriate manner onto a spreadsheet which I have called Game Scores.

    In it in the columns we have the following:

    A: Date
    B: Visiting Team
    C: Goals (formated to number)
    D: Home Team
    E: Goals (formated to number)

    The next relevant column would be I which would be my adjusted margin of victory ((E-C) - Home Ice Advantage). I'll figure out the typical home ice advantage using solver later (for the moment I've just added a random figure).

    The next sheet I have just called Data Sheet (original I know!). In it we have the following columns:

    A: Teams (starting with Anaheim Ducks in A2 - I just copied the scores from the previous sheet, sorted alphabetically and cut out what I didn't need)
    B: Margin of Victory - here's my problem I am now trying to get an Average Margin of Victory based on the data on the Game Scores sheet. The formula I have gone for in the case of Anaheim in cell A2 is as follows:

    =AVERAGE(IF('Game Scores'!$D$2:$D$211=A2,'Game Scores'!$I$2:$I$211))

    D2 - D211 is the range of cells with Home Teams in it, with I2 - I211 being the corresponding margin of victory (positive or negative for the home team in that game).

    Essentially in this case it returns a value of 0, but when I check the calculator tool it returns a value of -0.52 (for cell B2), which makes me think I've made a mistake in my formula somewhere (which is over riding the value)??.

    I'm thinking the AVERAGE is right (as I'm trying to get the average score), and the IF is right (as if any of the cells on Game Scores between D2 and D211 = A2 which is Anaheim Ducks, then the value it returns is the adjusted Margin of Victory from Games Scores for the corresponding cells between I2 and I211) - hence I'm a bit confused as to what I've missed. I would greatly appreciate any advice, as it's been a while since I've done something this complicated (for me) so I'm sure it's something obvious I've missed.

    Many thanks,
    Last edited by mrvp; 11-13-2011 at 05:57 PM.

  2. #2
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Sports Rankings

    Hi
    Your formula needs to be entered as an array formula with Ctrl+Shift+Enter. Alternatively, you could use the following non-array formula:

    =SUMIF('Game Scores'!$D$2:$D$211,A2,'Game Scores'!$I$2:$I$211)/COUNTIF('Game Scores'!$D$2:$D$211,A2)

    Hope this helps.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1