Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Stopping a calculation (XP Edition)

    Hi,

    I have cells in a worksheet which calculate the average cost of nursing of visits being made. I'm using a simple formula to find the average.
    The formula works fine except in instances where the cell used to divide is =0. The error #DIV/0! is returned as I would expect. I would like to be able to code this so that if the value in the cell being used to divide is = 0 then the cell containing the formula would return a value of 0.

    Thanks,
    Leesha

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Stopping a calculation (XP Edition)

    Say that you have a formula =A1/B1. This will result in #DIV/0! if B1 is zero. You can replace the formula by =IF(B1=0,0,A1/B1) to return 0 if B1 is zero, or =IF(B1=0,"",A1/B1) to return an empty value if B1 is zero.

  3. #3
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Stopping a calculation (XP Edition)

    Hi Hans!!

    Boy you help out all over! That did exactly what I wanted it to. I've never put IF/Than statements directly into the cells as formulas.

    Thanks so much for the help.

    Leesha

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •