+ Reply to Thread
Results 1 to 6 of 6

Division by Zero Error

  1. #1
    Ken D.
    Guest

    Division by Zero Error

    I am using this formula to average the values in cells F49:J49 if the value
    is greater than zero.

    =SUMIF(F49:J49,">0")/COUNTIF(F49:J49,">0")

    When all values are 0, I'm getting the division by zero error.

    Just a little help please...

  2. #2
    Forum Contributor
    Join Date
    11-29-2005
    Posts
    142
    Do you just want a blank cell if all cells are zero?

    If so,

    =IF(SUM(F49:J49)=0,"",SUMIF(F49:J49,">0")/COUNTIF(F49:J49,">0"))

  3. #3
    bpeltzer
    Guest

    RE: Division by Zero Error

    You could put the entire average calculation inside an if that detects a 0
    denominator and avoids the division in such cases:
    =if(countif(F49:j49,">0")=0, 0, your average calculation)

    "Ken D." wrote:

    > I am using this formula to average the values in cells F49:J49 if the value
    > is greater than zero.
    >
    > =SUMIF(F49:J49,">0")/COUNTIF(F49:J49,">0")
    >
    > When all values are 0, I'm getting the division by zero error.
    >
    > Just a little help please...


  4. #4
    Ken D.
    Guest

    Re: Division by Zero Error

    Thanks Vito,

    I used this solution and it worked terrific.

    Thanks again...

    "Vito" wrote:

    >
    > Do you just want a blank cell if all cells are zero?
    >
    > If so,
    >
    > =IF(SUM(F49:J49)=0,"",SUMIF(F49:J49,">0")/COUNTIF(F49:J49,">0"))
    >
    >
    > --
    > Vito
    > ------------------------------------------------------------------------
    > Vito's Profile: http://www.excelforum.com/member.php...o&userid=29182
    > View this thread: http://www.excelforum.com/showthread...hreadid=494713
    >
    >


  5. #5
    Ashish Mathur
    Guest

    RE: Division by Zero Error

    Hi,

    You may use the following array formula (Ctrl+Shift+Enter):

    =average(if((F49:J49>0),F49:J49))

    Regards,

    Ashish Mathur

    "Ken D." wrote:

    > I am using this formula to average the values in cells F49:J49 if the value
    > is greater than zero.
    >
    > =SUMIF(F49:J49,">0")/COUNTIF(F49:J49,">0")
    >
    > When all values are 0, I'm getting the division by zero error.
    >
    > Just a little help please...


  6. #6
    Forum Contributor
    Join Date
    11-29-2005
    Posts
    142
    Quote Originally Posted by Ashish Mathur
    Hi,

    You may use the following array formula (Ctrl+Shift+Enter):

    =average(if((F49:J49>0),F49:J49))

    Regards,

    Ashish Mathur
    That stills gets you the #DIV/0 error message, which the OP was getting originally, when all cells in the range are 0

+ 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