+ Reply to Thread
Results 1 to 10 of 10

#DIV/0 error - don't want to hide the error, need to work around it

  1. #1
    Registered User
    Join Date
    11-28-2015
    Location
    PA
    MS-Off Ver
    2003
    Posts
    4

    #DIV/0 error - don't want to hide the error, need to work around it

    Excel novice warning! I'm trying to create a formula to calculate a selling price by dividing net cost by another number (the markup). This should display the Selling Price in the cell. The problem, of course, is that if there is no markup, the zero value yields the error. I found a fix to hide the error, but what I need the formula to do is test for a "0" value in the markup cell and if it finds one, pass the net cost cell contents into the selling price field. The reason is that the selling price field value is used in another area of the sheet. I hope I'm making some sense here. Thanks for any help you can offer!

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: #DIV/0 error - don't want to hide the error, need to work around it

    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: #DIV/0 error - don't want to hide the error, need to work around it

    Hi, welcome to the forum

    Will there actually be a 0 value, or will it be empty/blank?

    0 value...
    =if(A2=0,do-this,do-that)

    blank cell...
    =if(A2="",do-this,do-that)

    This will cover both...
    =if(OR(A2=0,A2=""),do-this,do-that)

    Beyond that, Im not sure what you mean by "pass the net cost cell contents into the selling price field."?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    11-28-2015
    Location
    PA
    MS-Off Ver
    2003
    Posts
    4

    Re: #DIV/0 error - don't want to hide the error, need to work around it

    Wow, thanks for the speedy help, TMS! I was over-complicating things, using ISERROR. Your solution is cleaner - thanks again.

  5. #5
    Registered User
    Join Date
    11-28-2015
    Location
    PA
    MS-Off Ver
    2003
    Posts
    4

    Re: #DIV/0 error - don't want to hide the error, need to work around it

    Thanks for the welcome and the help, Ford! The markup cell can be either a zero value or blank, though I'll usually input zero if there's no markup. What I meant about passing on the net cost cell contents was that if the markup cell contained zero/blank value, whatever is in the net cost cell should be copied to the selling cost cell.

    Trevor's suggestion seems to be working fine, but I'll fiddle around with your suggestions, as well. More than one way to skin a cat, huh?

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: #DIV/0 error - don't want to hide the error, need to work around it

    Adapting Trevor's suggestion...
    =IF(OR(markup=0,markup=""), net, net/markup)

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: #DIV/0 error - don't want to hide the error, need to work around it

    @Ford:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    will cope with either blank or zero, but not space, though I guess it doesn't hurt to be specific.

    Regards, TMS

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: #DIV/0 error - don't want to hide the error, need to work around it

    You're welcome. Thanks for the rep.


    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  9. #9
    Registered User
    Join Date
    11-28-2015
    Location
    PA
    MS-Off Ver
    2003
    Posts
    4

    Re: #DIV/0 error - don't want to hide the error, need to work around it

    Done and done. Thanks again to both of you. Be prepared - I'll likely be asking for more help in the near future. Haven't used Excel in eons (self-taught), and am trying to finally learn the basics correctly.

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: #DIV/0 error - don't want to hide the error, need to work around it


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro Error - New error used to work
    By M4RSH in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-21-2013, 05:52 AM
  2. How to truly hide an error?
    By ThomasCarter in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-19-2012, 11:30 AM
  3. Macros stop to work when work sheet is protected. Run time error 1004
    By sellim in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-18-2012, 01:14 AM
  4. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM
  5. Help hide my #N/A error!
    By EXCEL?? in forum Excel General
    Replies: 4
    Last Post: 04-19-2012, 06:20 PM
  6. hide #N/A error
    By tsioumiou in forum Excel General
    Replies: 7
    Last Post: 05-13-2010, 08:02 PM
  7. Hide #Value! when error
    By AmazingTrans in forum Excel General
    Replies: 5
    Last Post: 03-23-2009, 03:29 AM
  8. Error Handling - On Error GoTo doesn't trap error successfully
    By David in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-16-2006, 02:10 PM

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