+ Reply to Thread
Results 1 to 7 of 7

Countif Error

  1. #1
    Registered User
    Join Date
    09-10-2009
    Location
    San Diego
    MS-Off Ver
    Excel 2007
    Posts
    3

    Red face Countif Error

    I am using the following formula:
    =O260/(COUNTIF('CLOSED SALES ORDERS'!$A$2:$A$14765,'Input Sheet'!G260))
    This works just fine if the value column O260 is on the Closed Sales Order Tab. If it does not exist, I get the following error:
    #DIV/0!
    Is there any way to replace the #DIV/0! with a zero or a blank?
    I tried using ISERROR but it didn't seem to work. Maybe I'm not using it properly.
    Can anyone help me?
    Last edited by lmjones78; 09-11-2009 at 01:41 PM.

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097

    Re: Countif Error

    Hi,

    Welcome to the forum, does this help?

    =IF(O260="","",O260/(COUNTIF('CLOSED SALES ORDERS'!$A$2:$A$14765,'Input Sheet'!G260)))
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Registered User
    Join Date
    09-10-2009
    Location
    San Diego
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Countif Error

    Thank you so much for the reply.
    I copied and pasted your formula but I still get the #DIV/0! error.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Countif Error

    If you get #DIV/0! error that means you are trying to divide by zero, so that occurs when your COUNTIF returns zero. You can fix that like this

    =IF(COUNTIF('CLOSED SALES ORDERS'!$A$2:$A$14765,'Input Sheet'!G260),O260/COUNTIF('CLOSED SALES ORDERS'!$A$2:$A$14765,'Input Sheet'!G260),"")

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Countif Error

    Or, since you're using Excel 2007,

    =IFERROR(O260 / COUNTIF('CLOSED SALES ORDERS'!$A$2:$A$14765, 'Input Sheet'!G260), "")
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Countif Error

    Good thinking Steve........

  7. #7
    Registered User
    Join Date
    09-10-2009
    Location
    San Diego
    MS-Off Ver
    Excel 2007
    Posts
    3

    Talking Re: Countif Error

    You guys rule!!!
    Thank you so much for your help. It works perfectly.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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