+ Reply to Thread
Results 1 to 19 of 19

Hide #div/0 error

  1. #1
    Registered User
    Join Date
    09-07-2007
    Posts
    32

    Hide #div/0 error

    Anyone know how to get excel to display 0 instead of this? It pops up everywhere through my spreadsheet but cant get it to display 0.

    Regards

    Tom

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    =IF(ISERROR(A1/B1),0,A1/B1) or CF

    http://www.contextures.com/xlCondFormat03.html#Errors

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Valued Forum Contributor
    Join Date
    09-23-2005
    Location
    Bristol, UK
    MS-Off Ver
    2007
    Posts
    664
    Hi,

    Try this:

    =IF(ISERROR(your formula),0,your formula)

    HTH,

    SamuelT

  4. #4
    Registered User
    Join Date
    09-07-2007
    Posts
    32
    Still no joy.

    I have attached the file.

    The Summery worksheet is displaying information from the Details worksheet.

    So if you look in Details and scroll down to the green column titled Kunal Benpuri, under Bahadur, Shekhar you can see there is no values available in his tables so Cell D107 displays #DIV/0! but i'd like it to display 0 as it makes the Summery worksheet look messy.

    Any ideas would be great.

    Thanks Again

    Kindest Regards

    Tom
    Attached Files Attached Files

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    =IF(ISERROR(SUMPRODUCT(--(C93:C106)*(D93:D106))/C107),0,SUMPRODUCT(--(C93:C106)*(D93:D106))/C107)

    or use the Conditional Format idea on the link I provided

    VBA Noob

  6. #6
    Valued Forum Contributor
    Join Date
    09-23-2005
    Location
    Bristol, UK
    MS-Off Ver
    2007
    Posts
    664
    See attached. Seems to work fine.

    SamuelT
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    09-07-2007
    Posts
    32
    Hi thanks that works a treat.

    I know this is asking alot but would you be able to explain that formula for me. Just so i can understand whats going on where. I love to accept help but i like to understand how things work also just so it helps for future development.

    Cheers

    Tom

  8. #8
    Registered User
    Join Date
    09-07-2007
    Posts
    32
    Quote Originally Posted by SamuelT
    See attached. Seems to work fine.

    SamuelT
    Thank You Sir

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,699
    To avoid #DIV/0! errors you only really need to test whether the Denominator is zero, therefore you can use this formula

    =IF(C107,SUMPRODUCT(C93:C106,D93:D106)/C107,0)

  10. #10
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520
    Hi tompich,

    Try this also:

    On cell D107:

    ={IF(C93:C106 = 0, 0, SUM(C93:C106*D93:D106)/C107)}
    Corine

  11. #11
    Registered User
    Join Date
    09-07-2007
    Posts
    32
    Hi the only problem with this is that it only works if the table is empty. If i populate the table with figures the figure remains 0. Is there an alternative formula that allows it to work both ways?

  12. #12
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,699
    Hello tompich, which suggestion are you referring to? My suggestion above will give the correct results when numbers are added, I believe, and it doesn't require CTRL+SHIFT+ENTER

    =IF(C107,SUMPRODUCT(C93:C106,D93:D106)/C107,0)

  13. #13
    Registered User
    Join Date
    09-07-2007
    Posts
    32
    Quote Originally Posted by daddylonglegs
    Hello tompich, which suggestion are you referring to? My suggestion above will give the correct results when numbers are added, I believe, and it doesn't require CTRL+SHIFT+ENTER

    =IF(C107,SUMPRODUCT(C93:C106,D93:D106)/C107,0)
    No your formula doesnt work once the table is populate it just gives 0 throughout. Its half way there and i could make do with it. But its not far off. If you have any other ideas then fantastic. I'll contiune to play with it and see what i can do.

  14. #14
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,699
    OK, I see, formula would work except your percentages derived from VLOOKUP formula are text formatted, you can fix very easily by changing the , in SUMPRODUCT to a *, i.e.

    =IF(C107,SUMPRODUCT(C93:C106*D93:D106)/C107,0)

  15. #15
    Registered User
    Join Date
    09-07-2007
    Posts
    32
    Quote Originally Posted by daddylonglegs
    OK, I see, formula would work except your percentages derived from VLOOKUP formula are text formatted, you can fix very easily by changing the , in SUMPRODUCT to a *, i.e.

    =IF(C107,SUMPRODUCT(C93:C106*D93:D106)/C107,0)
    Hmm i just tried the new formula and still no success. Have you tried it out in the attached spreadsheet and got it to work?

  16. #16
    Registered User
    Join Date
    09-07-2007
    Posts
    32
    Quote Originally Posted by daddylonglegs
    OK, I see, formula would work except your percentages derived from VLOOKUP formula are text formatted, you can fix very easily by changing the , in SUMPRODUCT to a *, i.e.

    =IF(C107,SUMPRODUCT(C93:C106*D93:D106)/C107,0)
    Oh no its working now!

    Cheers Sir

  17. #17
    Registered User
    Join Date
    09-07-2007
    Posts
    32
    Ok, Last question.

    In the summery the Percent Completed also shows some #DIV/0! and i cant use any formulas to get it to display 0.

    any ideas?

  18. #18
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,699
    In Summary G8 you have

    =AVERAGE(G6:G7)

    I wouldn't use any average formulas here, otherwise you are averaging averages which is mathematically unwise. Try using this formula in E6, replicated for all other rows including totals like G8

    =IF(E6,F6/E6,0)

  19. #19
    Registered User
    Join Date
    09-07-2007
    Posts
    32
    Quote Originally Posted by daddylonglegs
    In Summary G8 you have

    =AVERAGE(G6:G7)

    I wouldn't use any average formulas here, otherwise you are averaging averages which is mathematically unwise. Try using this formula in E6, replicated for all other rows including totals like G8

    =IF(E6,F6/E6,0)
    Cheers!!!!!!

+ 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