+ Reply to Thread
Results 1 to 7 of 7

Thread: 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 02:41 PM.

  2. #2
    "Eagle Eyed" Forum Moderator oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Work) and 2007 (Home)
    Posts
    7,130

    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
    -------------


    If you are happy with the help you have received, please click the blue scales icon in the blue bar of the post.

    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 Moderator daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2007
    Posts
    9,506

    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 Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,133

    Re: Countif Error

    Or, since you're using Excel 2007,

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

  6. #6
    Forum Moderator daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2007
    Posts
    9,506

    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.

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.2.0