+ Reply to Thread
Results 1 to 9 of 9

Divide by zero

  1. #1
    Forum Contributor
    Join Date
    05-18-2012
    Location
    Chicopee, Ma
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    196

    Divide by zero

    I have a spreadsheet that shows a department sumarry.
    One cell say B have the number of jobs in house, cell C has the number of jobs at the vendor.
    To find the percentage of jobs at the vendor I divide the value in cell C by the value in cell B =sum(c9/b9)
    That works great except sometimes for a particular department I may not have any jobs in house or at the vendor, then of corse I get an error #DIV/0!
    my qusetion is, is ther a better way to set this up so my users don't see a divide by zero error?

    Thanks

    Matt

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Divide by zero

    Try:

    =IF(B9=0, "", C9/B9)

  3. #3
    Registered User
    Join Date
    04-19-2010
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Divide by zero

    You can use ifError([statement],0) Anytime it picks up an error it will default to 0 (or whatever you put as the second argument)
    Excel\Access, VBA, C#, C++, SQL, Java

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Divide by zero

    You can hide it using ISERROR, or check for empty cells with your formula
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,450

    Re: Divide by zero

    Or = IFERROR(C9/B9,"") for post 2003 versions

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Divide by zero

    Quote Originally Posted by Pepe Le Mokko View Post
    Or = IFERROR(C9/B9,"") for post 2003 versions
    His profile show 2003 version

  7. #7
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,450

    Re: Divide by zero

    Quote Originally Posted by zbor View Post
    His profile show 2003 version
    yes it does

  8. #8
    Registered User
    Join Date
    04-19-2010
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Divide by zero

    D'oh I missed 2003. Then yea, probably want to go with the Zbor's answer. I might still suggest putting a 0, or something other than "blank" in, just for aesthetics but it's up to you. Might not be important at all.

  9. #9
    Forum Contributor
    Join Date
    05-18-2012
    Location
    Chicopee, Ma
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    196

    Re: Divide by zero

    It works great, thanks

+ 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