+ Reply to Thread
Results 1 to 8 of 8

Average of Cells

  1. #1
    Registered User
    Join Date
    11-02-2006
    Location
    Pakistan
    Posts
    33

    Average of Cells

    Thanks Marcol for sending reply. But issue not solved while using the formula.

    =IF(ISERROR(AVERAGE(A1,B1,C1,D1,E1,F1)),0,AVERAGE(A1,B1,C1,D1,E1,F1))

    It returns Average as = 0.

    For more clarity,
    A2 42.5
    B2 #DIV/0! (Linked cell to another sheet)
    C2 46.1
    D2 43.7
    E2 #DIV/0! ! (Linked cell to another sheet)
    F2 #DIV/0! ! (Linked cell to another sheet)

    I need to calculate average for A21, B2, C2, D2, E2 & F2. Keeping same values as I mentioned
    When I put simple average formula =AVERAGE(A1:F1) of above range if shows #DIV/0! as resultant.
    Need some logical test so that formula should get average of specified range by ignoring #DIV/0! from cells & average should be 37.5 in the case above.

    Cheers.
    Last edited by Reyan123; 05-13-2010 at 01:50 AM. Reason: Getting Error While Using Formula

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Average of Cells

    Try something on these lines

    =IF(ISERROR(AVERAGE(A2:A11)),"",AVERAGE(A2:A11))

    I don't know what range you are averaging

    Hope this helps

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,576

    Re: Average of Cells

    Or try to avoid DIV/0 results in original cells.

    For example:

    =IF(ISERR(A1/B2), "", A1/B2)

    so your average will work

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Average of Cells

    zbor is correct in his approach, go that way in addition to my suggestion.

    However watch what you are averaging.

    Compare
    =IF(ISERR(A1/B2), "", A1/B2)

    If you have say 5 cells to average and all but one returns "" then the average will be Total/1

    and
    =IF(ISERR(A1/B2), 0, A1/B2)

    If you have say 5 cells to average and all but one returns 0 then the average will be Total/5

    To cover all cells being "" or 0 still use a concluding formula similar to that in post #2

    Hope this helps

    P.S.
    see attachment for clarification
    Attached Files Attached Files
    Last edited by Marcol; 05-11-2010 at 06:39 AM. Reason: Attachment added

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Average of Cells

    As outlined correcting underlying errors is nearly always the best approach.

    If for whatever reason you can't do that please outline

    a) version of XL in use

    b) whether your average range is non-contiguous (as implied by initial cell references)

    For ex. for a contiguous range in XL2007 and beyond:

    =AVERAGEIF(A1:F4,"<9.99E+307",A1:F4)

    Prior to XL2007 for contiguous range

    =SUMIF(A1:F4,"<9.99E+307")/COUNTIF(A1:F4,"<9.99E+307")

    For non-contiguous ranges things become more complicated.

  6. #6
    Registered User
    Join Date
    11-02-2006
    Location
    Pakistan
    Posts
    33

    Re: Average of Cells

    Thanks Marcol for sending reply. But issue not solved while using the formula.

    =IF(ISERROR(AVERAGE(A1,B1,C1,D1,E1,F1)),0,AVERAGE(A1,B1,C1,D1,E1,F1))

    It returns Average as = 0.

    For more clarity,
    A2 42.5
    B2 #DIV/0! (Linked cell to another sheet)
    C2 46.1
    D2 43.7
    E2 #DIV/0! ! (Linked cell to another sheet)
    F2 #DIV/0! ! (Linked cell to another sheet)

    I need to calculate average for A21, B2, C2, D2, E2 & F2. Keeping same values as I mentioned
    When I put simple average formula =AVERAGE(A1:F1) of above range if shows #DIV/0! as resultant.
    Need some logical test so that formula should get average of specified range by ignoring #DIV/0! from cells & average should be 37.5 in the case above.

    Cheers.

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Average of Cells

    Quote Originally Posted by Reyan123
    Need some logical test so that formula should get average of specified range by ignoring #DIV/0! from cells & average should be 37.5 in the case above.
    Did you read my prior post ?

    Marcol's suggestion is for trapping an overall error in the Average calc and is not intended to average the numerics.

    zbor's suggestion is to modify your "linked cell to another sheet" formula such that it removes the #DIV/0! error in the first instance.
    If you're not plotting the data points (ie chart) that would be the best approach (using Null as replacement value)
    Last edited by DonkeyOte; 05-13-2010 at 04:00 AM. Reason: added note re: zbor's suggestion

  8. #8
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Average of Cells

    I believe the workbook I attached in post #4 demonstrates all your requirements.

    To capture the errors in your data you must first check each cell in your range for errors

    for example
    =IF(ISERR(A2),"",A2)

    or
    =IF(ISERR(A2),0,A2)

    Then use the average formula.

    Cheers

+ 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