+ Reply to Thread
Results 1 to 14 of 14

Average If...

  1. #1
    Registered User
    Join Date
    09-07-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    10

    Average If...

    Hi,

    I am trying to create a spreadsheet to monitor golf statistics.

    If you're unfamiliar with golf, you typically have 18 holes and they are either par 3, par 4 or par 5. I specifically want to monitor the average score on par 3s and the same for par 4s and par 5s.

    So far headings look like this:

    A1 - Course Played
    B1 - Date
    C1 - avergae par 3 score
    D1 - average par 4 score
    E1 - average par 5 score
    F1 - hole 1 score
    G1 - hole 2 score
    and so on through to hole 18

    I input each players' score for holes 1-18.

    My issue concerns the average score. Lets take the par 3 for example. I have a drop down list for the course played and each course will have different pars for each hole. So I want the average par 3 score cell to say 'If A2 = 'Pebble Beach' then take the average of cells G2, J2, L2 and O2'

    So A2 being the course played and G2, J2, L2 and O2 are the holes that are par 3s so they are the scores I want to average for that round.

    In addition to that I want the formula to average different holes if A2 = a diffent course that has different holes as its Par 3s.

    So if A2 was a different course then different cells should be averaged.

    Is this clear?

    Btw, the above is simplified, the actually formula I started with is below.

    =IF(B4=AT3,"(=AVERAGE(U4,W4,AA4,AE4,AG4,AK4))")

    B4 is Course Played
    AT3 is also the course played but where it is listed for the purpose of the drop down list in B4
    the cells being averaged are the cells that the course in question has as par 3s.

    The problem is that I can't get excel to recognise the average part as a formula. It just sees it as text and displays the whole formula instead of displaying the result of the calculation.

    I appreciate any help.

    Regards,

    Ryan

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Average If...

    Remove the quotation marks " around the average formula.

    Furthermore, you might want to create a dynamic formula on the lines of

    =average(if(x=y,rangeofdata,false)
    Confirm with Ctrl+Shift+Enter and not just Enter

    In later versions of Excel you could also use the AVERAGEIF function.

    Uploading a sample worksheet will help understand your problem better
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: Average If...

    IF(B4=AT3,"(=AVERAGE(U4,W4,AA4,AE4,AG4,AK4))")

    The Blue part of your formula is wrong
    This formula will work but you had only one condition, I added the second condition as a blank ""
    =IF(B4="AT3",AVERAGE(U4,W4,AA4,AE4,AG4,AK4),"")

    Excel would interprete AT3 as cell AT3 not course AT3. That's why that is in quotes

    A sample workbook might help
    Last edited by K m; 09-07-2012 at 08:09 AM.
    Click on star (*) below if this helps

  4. #4
    Registered User
    Join Date
    09-07-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Average If...

    Here is a sample worksheet.

    I have highlighted the holes taht are par 3s on each course.

    Thanks.
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: Average If...

    In your example workbook, the correct formula for cell E6 is:
    =IF(C6=C12,AVERAGE(K6,O6,R6,T6),"")

    Copy this formula down

  6. #6
    Registered User
    Join Date
    09-07-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Average If...

    Quote Originally Posted by K m View Post
    In your example workbook, the correct formula for cell E6 is:
    =IF(C6=C12,AVERAGE(K6,O6,R6,T6),"")

    Copy this formula down
    Thanks that worked!

    I have one more issue.

    How do I put more than one if formula in the same cell?

    So I want to say as in the above quote:

    =IF(C6=C12,AVERAGE(K6,O6,R6,T6),"")

    however

    if C6 = C13 then I want different cells to be used in the average formula

    and also different ones for if C6 = C14 for example

    Thanks again.

    Ryan

  7. #7
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Average If...

    Use..

    =IF(C6=C12,AVERAGE(K6,O6,R6,T6),IF(C6=C13,AVERAGE(..............),IF(C6=C14,AVERAGE(...............),"")))

  8. #8
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Average If...

    Hi Ryan

    I have put the Pars in Cells E1:G1 and used the sumif function within the average function. So if the hole pars differ you should have them covered! Copy of sheet attached

    In Cell: E6 and drag across to G6, down to G8.
    =IF($C6=$C12,AVERAGE(SUMIF($H6:$Y6,E$1)),"")
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    09-07-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Average If...

    Quote Originally Posted by Ace_XL View Post
    Use..

    =IF(C6=C12,AVERAGE(K6,O6,R6,T6),IF(C6=C13,AVERAGE(..............),IF(C6=C14,AVERAGE(...............),"")))
    That's brilliant thanks it worked perfectly.

  10. #10
    Registered User
    Join Date
    09-07-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Average If...

    I have another question.

    I need a formula to calculate the average score for each individual hole on the specific courses.

    I've attached another sample worksheet; the '?' are the cells concerned.

    Cell D17 would need to calculate the avergae of all the scores on hole 1 for each round played, but only when that round was played at Course A. D18 would do the same for Course B rounds and cell D19 for Course C rounds.

    Thanks,

    Ryan.
    Attached Files Attached Files

  11. #11
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Average If...

    How about you have a go. I think ever one has given you enough info!

  12. #12
    Registered User
    Join Date
    09-07-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Average If...

    Quote Originally Posted by Kevin UK View Post
    How about you have a go. I think ever one has given you enough info!
    I've been on this bit for over an hour. I'll keep trying but if anyone has any advice I'd appreciate it.

    Thanks.

  13. #13
    Registered User
    Join Date
    09-07-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Average If...

    Got it.

    Didn't know I could use AverageIf in 2003 so had to use an array.

    D17=AVERAGE(IF(B6:B8=B12:B14,D6:D8))

    Thanks again for the first bit I would never have got that.

    Ryan

  14. #14
    Forum Expert icestationzbra's Avatar
    Join Date
    01-07-2004
    MS-Off Ver
    2007, 2010
    Posts
    1,421

    Re: Average If...

    "AVERAGEIF" is the name of a new function available only in versions 2007 onwards.

    "AVERAGE(IF", as employed here "D17=AVERAGE(IF(B6:B8=B12:B14,D6:D8)", is not exactly the same as the "AVERAGEIF" function.

    just to clarify...
    Last edited by icestationzbra; 09-07-2012 at 01:15 PM.
    - i.s.z -
    CSE, aka Array aka { }, formulae are confirmed with CONTROL+SHIFT+ENTER.
    Replace commas ( , ) with semicolons ( ; ) in formulae, if your locale setting demands.
    All good ideas are courtesy resources from this forum as well as others around the web.
    - e.o.m -

+ 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