+ Reply to Thread
Results 1 to 5 of 5

#DIV/0! error for an array function

  1. #1
    Forum Contributor
    Join Date
    02-05-2014
    Location
    Bay Area
    MS-Off Ver
    Excel 2010
    Posts
    164

    #DIV/0! error for an array function

    Hello,

    I have a minor problem that is bugging me.

    I have a formula that works fine; however, I get the #DIV/0! error when data does not fit the formula within my array. I'd rather the cell be blank, or show a zero, than show the error. The source of the error is the AVERAGE function, and Excel is trying to divide by a zero number. However, I cannot figure out how to write the formula so that the AVERAGE doesn't show an error result. I messed around with the ISNUMBER function, but I couldn't get it to work properly.

    I attached a sample spreadsheet with the problem formula. There are a few #DIV/0! messages on the screen, but the problem is consistent across my calculations. If I can solve one of them, I can solve them all. I highlighted the cell I've been working on, in yellow. The other cells are values, but they behave similarly when populated with formulas. The yellow highlighted cell (E8) is my focus.

    Thanks in advance for any advice or help!
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,970

    Re: #DIV/0! error for an array function

    =iferror(IF(P3<$A7,"",AVERAGE(IF(('Data Sheet'!E1:E48>A7)*('Data Sheet'!E1:E48<=A8)*('Data Sheet'!$C$1:$C$48<>"Purchase")*('Data Sheet'!$D$1:$D$48<>"Correspondent"),'Data Sheet'!$F$1:$F$48))),"")

    Enter this as an array formula.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

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

    Re: #DIV/0! error for an array function

    Try it like this in E8:

    =IF($P$3<$A7,"",IFERROR(AVERAGE(IF(('Data Sheet'!E$1:E$48>A7)*('Data Sheet'!E$1:E$48<=A8)*('Data Sheet'!$C$1:$C$48<>"Purchase")*('Data Sheet'!$D$1:$D$48<>"Correspondent"),'Data Sheet'!$F$1:$F$48)),""))

    This is still an array formula, so you need to commit it using CSE. I've made the row ranges absolute, so you should be able to copy this elsewhere.

    Hope this helps.

    Pete

  4. #4
    Forum Contributor
    Join Date
    02-05-2014
    Location
    Bay Area
    MS-Off Ver
    Excel 2010
    Posts
    164

    Re: #DIV/0! error for an array function

    AliGW and Pete_UK --
    Thank you so much for your help. I found my answer with your help!!! Have a great day.
    Jeff

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,970

    Re: #DIV/0! error for an array function

    You're welcome!

+ 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. index function error using match function to get data from a cell in an array
    By mabildgaard in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-17-2013, 02:21 AM
  2. Copy two array: Function RtlMoveMemory() in Excel 64-bit is error?
    By tuanktcdcn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-07-2013, 02:44 PM
  3. Date array function has type mismatch error...
    By secret2 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-21-2011, 02:07 PM
  4. RANK function and Array Formula Error
    By Sparky12 in forum Excel General
    Replies: 4
    Last Post: 02-28-2009, 05:46 PM
  5. #DIV/0! error in Average If Array function
    By ren1104 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-28-2007, 02:24 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