+ Reply to Thread
Results 1 to 25 of 25

Value error with average formula - Because of blank cells?

  1. #1
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Value error with average formula - Because of blank cells?

    Ok here's the situation:

    I am averaging 4 cells out of a possible 6. 2 cells are constant. The other 2 cells are chosen from a possible 4 cells depending on a search function in my formula.


    Still, all in all, 4 cells are being averaged. Yet, when one of these 4 cells is blank, I get a value error. There is an error formula in this blank cell that returns blank based on the formula.

    I want the formula to average depending on the number of values are present. So if there are 3 values present, then it divides by 3, two values present, divides by two, and so on...


    =AVERAGE(O11,IF(ISERROR(SEARCH("throws R",T11)),BC11*4.2,BO11*4.2),IF(ISERROR(SEARCH("at",T11)),CM11*4.2,CA11*4.2),(AF11*4.2))

  2. #2
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Value error with average formula - Because of blank cells?

    Anyone have any idea?

  3. #3
    Forum Contributor
    Join Date
    07-16-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2013
    Posts
    176

    Re: Value error with average formula - Because of blank cells?

    could you place all 6 cells in one column and use an averageifs formula? For example: AVERAGEIFS(C:C,C:C,"<>"&"") will average all items in column C that are non blanks.

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

    Re: Value error with average formula - Because of blank cells?

    If you're getting a #VALUE! error that means one or more of these cells contains text (or a formula blank):

    BC11
    BO11
    CM11
    CA11
    AF11

    You could try putting them inside the N(...) function:

    N(BC11)*4.2
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Value error with average formula - Because of blank cells?

    Quote Originally Posted by igoodable View Post
    could you place all 6 cells in one column and use an averageifs formula? For example: AVERAGEIFS(C:C,C:C,"<>"&"") will average all items in column C that are non blanks.
    Not preferably, I have hundreds of rows of data so I would need to create hundreds of columns

  6. #6
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Value error with average formula - Because of blank cells?

    Quote Originally Posted by Tony Valko View Post
    If you're getting a #VALUE! error that means one or more of these cells contains text (or a formula blank):

    BC11
    BO11
    CM11
    CA11
    AF11

    You could try putting them inside the N(...) function:

    N(BC11)*4.2
    Yes, these cells have a formula in them even if blank

    Tried the N function. It works, but it just continuously divides by 4. It does not divide by the amount of numbers that are present
    Last edited by nobodyukno; 07-16-2013 at 04:26 PM.

  7. #7
    Forum Contributor
    Join Date
    07-16-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2013
    Posts
    176

    Re: Value error with average formula - Because of blank cells?

    you'll need an iserror condition for each of the calculated cell. IE: IF(ISERROR(BC11*4.2),"",BC11*4.2)

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

    Re: Value error with average formula - Because of blank cells?

    Try it like this...

    =AVERAGE(O11,IFERROR(IF(ISERROR(SEARCH("throws R",T11)),BC11*4.2,BO11*4.2),{""}),IFERROR(IF(ISERROR(SEARCH("at",T11)),CM11*4.2,CA11*4.2),{""}),IFERROR(AF11*4.2,{""}))

  9. #9
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Value error with average formula - Because of blank cells?

    Quote Originally Posted by Tony Valko View Post
    Try it like this...

    =AVERAGE(O11,IFERROR(IF(ISERROR(SEARCH("throws R",T11)),BC11*4.2,BO11*4.2),{""}),IFERROR(IF(ISERROR(SEARCH("at",T11)),CM11*4.2,CA11*4.2),{""}),IFERROR(AF11*4.2,{""}))
    Thats giving me a value error

  10. #10
    Forum Contributor
    Join Date
    07-16-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2013
    Posts
    176

    Re: Value error with average formula - Because of blank cells?

    =AVERAGE(O11,IF(ISERROR(SEARCH("throws R",T11)),if(iserror(BC11*4.2),"",BC11*4.2),if(iserror(BO11*4.2),"",BO11*4.2)),IF(ISERROR(SEARCH("at",T11)),if(iserror(CM11*4.2),"",CM11*4.2),if(iserror(CA11*4.2),"",CA11*4.2)),(AF11*4.2))

  11. #11
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Value error with average formula - Because of blank cells?

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  12. #12
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Value error with average formula - Because of blank cells?

    There's too many formulas to try to recreate so I'm uploading the workbook.

    So column CV is where the formula will go. What the formula should do is the following starting with cell CV5:

    1.) Take the value from O5
    2.) Take the value from AF5
    3.) Depending on the contents in T5, the value from either cell BC5 or BO5 will be taken
    4.) Depending on the contents in T5, the value from either cell CA5 or CM5 will be taken
    * The search function is listed in the first post
    5.) Average these four values
    * As you can see from the workbook, the blank cells have formulas in them


    The results should be the following:
    CV5 - 1.48095
    CV12 - 1.75016 (This cell should be divided by 3 as cells AF5 is blank)

    Book1.xlsx

  13. #13
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Value error with average formula - Because of blank cells?

    Anyone take a stab at it?

  14. #14
    Forum Contributor
    Join Date
    07-16-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2013
    Posts
    176

    Re: Value error with average formula - Because of blank cells?

    Quote Originally Posted by nobodyukno View Post
    Yes, these cells have a formula in them even if blank

    Tried the N function. It works, but it just continuously divides by 4. It does not divide by the amount of numbers that are present
    The reason it's divided by 4 because the n function yield value of 0 and therefore included in the average calculation. If you replace the n function with an iserror formula and replace the error with a blank value, average will ignore these values. What error did you get from my formula?

  15. #15
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Value error with average formula - Because of blank cells?

    Quote Originally Posted by igoodable View Post
    The reason it's divided by 4 because excel counts the n function yield value of 0 and included in the average. Therefore if you replace the n function with an iserror formula and replace the error with a blank value, average will ignore these values. What error did you get from my formula?
    I got value errors for the cells that did not pull 4 cells of data. Again, the blank cells have formulas in them so I don't know if that is what's causing the value error. I attached the workbook in my last post

  16. #16
    Forum Contributor
    Join Date
    07-16-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2013
    Posts
    176

    Re: Value error with average formula - Because of blank cells?

    does o11 and af11 always have a value? If not, you'll need to put an iserror formula on it too.

  17. #17
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Value error with average formula - Because of blank cells?

    Quote Originally Posted by igoodable View Post
    does o11 and af11 always have a value? If not, you'll need to put an iserror formula on it too.
    The only one that always has a value is O11

  18. #18
    Forum Contributor
    Join Date
    07-16-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2013
    Posts
    176

    Re: Value error with average formula - Because of blank cells?

    =AVERAGE(O11,IF(ISERROR(SEARCH("throws R",T11)),IF(ISERROR(BC11*4.2),"",BC11*4.2),IF(ISERROR(BO11*4.2),"",BO11*4.2)),IF(ISERROR(SEARCH("at",T11)),IF(ISERROR(CM11*4.2),"",CM11*4.2),IF(ISERROR(CA11*4.2),"",CA11*4.2)),IF(ISERROR(AF11*4.2),"",AF11*4.2))

    what about this? I couldn't open your workbook btw... all the values becomes error even if I click do not update.

  19. #19
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Value error with average formula - Because of blank cells?

    Quote Originally Posted by igoodable View Post
    =AVERAGE(O11,IF(ISERROR(SEARCH("throws R",T11)),IF(ISERROR(BC11*4.2),"",BC11*4.2),IF(ISERROR(BO11*4.2),"",BO11*4.2)),IF(ISERROR(SEARCH("at",T11)),IF(ISERROR(CM11*4.2),"",CM11*4.2),IF(ISERROR(CA11*4.2),"",CA11*4.2)),IF(ISERROR(AF11*4.2),"",AF11*4.2))

    what about this? I couldn't open your workbook btw... all the values becomes error even if I click do not update.

    Same thing where it computes, but it returns a value error for any cells that don't have all 4 cells with data.

    Hmm I guess that's because pretty much all those cells have references to other worksheets that are not present in that workbook?


    EDIT:

    I had some luck I thought with this formula, but now it returns blank any cells that do not pull from 4 cells of data. Don't know what I would've changed to affect it.

    =IFERROR(AVERAGE(O11,IF(ISERROR(SEARCH("throws R",T11)),BC11*4.2,BO11*4.2),IF(ISERROR(SEARCH("at",T11)),CM11*4.2,CA11*4.2),(AF11*4.2)),"")
    Last edited by nobodyukno; 07-17-2013 at 11:25 AM.

  20. #20
    Forum Contributor
    Join Date
    07-16-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2013
    Posts
    176

    Re: Value error with average formula - Because of blank cells?

    yes - it is because of the links. Could you start a new book and produce a sample of the errors only? For example: include only relevant fields in the calculations and the items that would cause the error.

  21. #21
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Value error with average formula - Because of blank cells?

    Ok this should explain what is needed. Let me know if you have any questions:

    Book11.xlsx

    I'll explain the search function a little as well:

    1.) Searches for the word "throws R" in column A - If error (doesn't find the search) it takes the value from column D, if it finds the words "throws R" it takes the value from column E
    2.) Searches for the word "at" in column A - If error (doesn't find the search) it takes the value from column G, if it finds the word "at" it takes the value from column F

    **ALSO**

    This workbook isn't completely accurate to the real thing since columns C:G all have formulas with index/match functions in them. So if blank, these cells still have index/match formulas in them, and are not just completely blank.
    Last edited by nobodyukno; 07-17-2013 at 11:58 AM.

  22. #22
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Value error with average formula - Because of blank cells?

    Let me know if you guys have any questions regarding the workbook

  23. #23
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Value error with average formula - Because of blank cells?

    try each bit of the if on its own i had trouble un picking it
    what are the distinct things you are averaging
    average(b2,what1,what2,what3,what4)
    Last edited by martindwilson; 07-18-2013 at 12:35 AM.

  24. #24
    Forum Contributor
    Join Date
    07-16-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2013
    Posts
    176

    Re: Value error with average formula - Because of blank cells?

    I recommend you add four consecutive columns at the end of your spread sheet. Build if conditions for each of those columns to re-pull the values you need. THEN use averageif formula like I suggested initially. You'll use more real estate, but it'll solve your problem for sure.

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

    Re: Value error with average formula - Because of blank cells?

    I don't know if the logic of your formula is correct or not but...

    The AVERAGE function will only ignore text values when they're elements of an array (or range of cells).

    For example:

    =AVERAGE(O11,"","",AF11*4.2)

    Will return the #VALUE! error since the text values (the formula blanks) are not elements of an array (or a range of cells).

    In my earlier suggestion you may have noticed that I enclosed the formula blanks in squiggly brackets. This forces them to be evaluated as arrays (even though the array is just a single element) allowing the AVERAGE function to ignore them:

    =AVERAGE(O11,{""},{""},AF11*4.2)

    On a side note...

    I'm totally confused as to what the OP is wanting to do at this point!

    I looked at the most recent sample file (post #21) but still can't figure out what cells need to be calculated and under what conditions.

+ 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. average formula for non contiguous range and eliminate blank cells
    By kkotter in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-28-2013, 10:13 AM
  2. Average formula that starts at first cell>0 and calculates blank cells as 0?
    By bradtredo in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-20-2012, 05:54 PM
  3. [SOLVED] Average Formula that counts blank cells
    By ChrisHallas in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-01-2012, 08:20 AM
  4. Omit blank cells from SUMPRODUCT average formula?
    By Radchek in forum Excel General
    Replies: 2
    Last Post: 09-03-2010, 08:18 AM
  5. Replies: 4
    Last Post: 05-27-2009, 09:34 AM

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