+ Reply to Thread
Results 1 to 8 of 8

Formula for showing both dashes and zeros for #DIV=0! errors

  1. #1
    Registered User
    Join Date
    12-12-2022
    Location
    Toronto, Canada
    MS-Off Ver
    2016
    Posts
    5

    Formula for showing both dashes and zeros for #DIV=0! errors

    Hello. I need some guidance on trying to fix a problem in a formula that I've created.

    Basically, I have an IFERROR formula that puts a dash in the cell if a dividing by zero error occurs, however I need an extra piece of logic to show a zero instead of dash if a cell that isn't part of the formula is greater than zero. I've tried some IF formulas beside the IFERROR formula, but I can't get them to do what I want, so I clearly need something else. Any suggestions of what that should be would be great. I'm not an Excel master, so I probably won't understand any explanations that are too complicated. Thanks!

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.95 for Mac MS 365
    Posts
    8,690

    Re: Formula for showing both dashes and zeros for #DIV=0! errors

    upload a sample workbook (per yellow banner at the top of the post) with what you have AND what you want. It is difficult to debug a formula that we can't see.
    Last edited by Sam Capricci; 10-06-2023 at 10:18 PM.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    3,198

    Re: Formula for showing both dashes and zeros for #DIV=0! errors

    Maybe this? (assumes cell A1 is the cell that if >0, show a zero)

    =if(A1>0,0,iferror(your formula,"-")

    If this isn't it, like Sam has stated, please attach a sample workbook.

  4. #4
    Registered User
    Join Date
    12-12-2022
    Location
    Toronto, Canada
    MS-Off Ver
    2016
    Posts
    5

    Re: Formula for showing both dashes and zeros for #DIV=0! errors

    I tried the formula above and it just overrides the IFERROR formula with a zero. The spreadsheet is pretty big - I'll make a smaller version and upload it later unless there's another suggestion that works before I get to it.

  5. #5
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    3,198

    Re: Formula for showing both dashes and zeros for #DIV=0! errors

    It would only override the IFERROR with a 0 if A1>0, which is what you wanted. Yes, please attach a file.

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,399

    Re: Formula for showing both dashes and zeros for #DIV=0! errors

    What does your overall logic look like?

    If I assume that your logic is A) Perform calculation -> B) If the calculation errors then C) If this other cell is greater than 0 return 0, else return dash. Is that the correct logic? I can represent that logic by:

    =IFERROR(calculation,IF(other_cell>0,0,"-"))
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  7. #7
    Registered User
    Join Date
    12-12-2022
    Location
    Toronto, Canada
    MS-Off Ver
    2016
    Posts
    5

    Re: Formula for showing both dashes and zeros for #DIV=0! errors

    Quote Originally Posted by MrShorty View Post
    What does your overall logic look like?

    If I assume that your logic is A) Perform calculation -> B) If the calculation errors then C) If this other cell is greater than 0 return 0, else return dash. Is that the correct logic? I can represent that logic by:

    =IFERROR(calculation,IF(other_cell>0,0,"-"))
    This one is the winner - it shows the dash if there is a zero in the requested cell and the number if needed. Thanks!

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,668

    Re: Formula for showing both dashes and zeros for #DIV=0! errors

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

+ 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] errors and zeros
    By barneyrubble1965 in forum Excel General
    Replies: 12
    Last Post: 07-29-2015, 09:40 AM
  2. Replies: 3
    Last Post: 02-05-2015, 09:41 AM
  3. Replies: 8
    Last Post: 12-31-2014, 11:48 AM
  4. Pivot Table: Zeros to Dashes
    By GreatLakesJK in forum Excel General
    Replies: 7
    Last Post: 01-28-2011, 04:16 PM
  5. Formula not showing zeros
    By ryanb4614 in forum Excel General
    Replies: 8
    Last Post: 08-02-2010, 04:51 PM
  6. Replies: 2
    Last Post: 10-02-2005, 11:05 AM
  7. Displaying zeros as dashes on a worksheet
    By eschneider71@hotmail.com in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-12-2005, 06:06 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