+ Reply to Thread
Results 1 to 6 of 6

Ignoring errors when calculating average

  1. #1
    Forum Contributor
    Join Date
    06-16-2014
    Location
    Columbia, Maryland
    MS-Off Ver
    2013
    Posts
    134

    Ignoring errors when calculating average

    Ok so I've attached an example here. My issue is that when pulling data from a database I use at work in some cases the data may not be available for a specific company in a specific quarter but is for the other companies. My issue is that when calculating an average based off of the group if one group members number comes back out of the database as "NA" it throws off my average and relative calc. I need a formula that if the cell in the group that I am averaging comes back as "NA" will ignore it and re-calc the correct average without the cell with the "NA" in it.

    Again I've attached a sample spreadsheet and if someone could help me out and show me a fix I would greatly appreciate it!

    Cheers!
    Attached Files Attached Files

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,732

    Re: Ignoring errors when calculating average

    You can use this array* formula in I2:

    =AVERAGE(IF(ISNUMBER(A2:G2),A2:G2))

    *An array formula needs to be committed using the key combination of Ctrl-Shift-Enter (CSE) instead of the usual <Enter>.

    Then you can copy the formula down in the usual way(s).

    Hope this helps.

    Pete

  3. #3
    Forum Contributor
    Join Date
    06-16-2014
    Location
    Columbia, Maryland
    MS-Off Ver
    2013
    Posts
    134

    Re: Ignoring errors when calculating average

    Yes that works Great!!

    Thanks

  4. #4
    Forum Contributor
    Join Date
    06-16-2014
    Location
    Columbia, Maryland
    MS-Off Ver
    2013
    Posts
    134

    Re: Ignoring errors when calculating average

    Pete one other question for you if you don't mind. If the average is a negative number but the company in column "A" has a positive number How can I insert a formula into the relative column saying that if the average is negative to use addition instead of subtraction and vise versa?

    Cheers!

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,732

    Re: Ignoring errors when calculating average

    I think you might mean this:

    =A2-SIGN(I2)*I2

    or you could look into using the ABS function.

    Hope this helps.

    Pete

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Ignoring errors when calculating average

    Since you're using Excel 2013...

    =AGGREGATE(1,6,A2:G2)

    If there is no data to average you'll still get a #DIV/0! error.

    To prevent that use:

    =IFERROR(AGGREGATE(1,6,A2:G2),"")
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Calculating rolling average ignoring 0 values
    By Whitz in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-07-2024, 05:51 PM
  2. Calculating the Average for Every Other Number while Ignoring #N\A
    By leongandrew in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 05-09-2013, 10:05 PM
  3. Ignoring errors
    By Cmorgan in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 12-23-2011, 09:12 AM
  4. Replies: 1
    Last Post: 01-25-2011, 10:37 PM
  5. How do I ignore cells with errors when calculating an average?
    By M Enfroy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-01-2005, 04:09 PM

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