Consulting

Results 1 to 6 of 6

Thread: If statement

  1. #1

    If statement

    Hye there,
    just would like to ask several questionr regarding if statement. How can i return a value of "blank" if the reference cell is "0" from the another workshhet. If the cell in the other worksheet contain value, it will return the values else will return "blank"The example are as follows

    =if(sheet1!a1=0,"",=sheet1!a1)

    many thanks

  2. #2
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    Try this :
    Quote Originally Posted by da_phat
    =if(sheet1!a1=0,"",sheet1!a1)

  3. #3
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    I'm not sure what your question is?, if you put this in A1 sheet 1 =IF(Sheet2!A1=0,"",Sheet2!A1) then A1 sheet 1 will display blank if A1 sheet 2 is blank, which is exactly the formula you posted minus the 3rd =!
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  4. #4
    thx a lot. but the cell still give me #DIV/0. For your info the sheet which im referred to have the formula.does it have an affect.

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    =IF(OR(Sheet1!A1=0,Sheet1!A1=""),"",Sheet1!A1)

  6. #6
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    You didnt say that your formula was looking at a cell that contained a formula that currently shows DIV0#, you need to build in error handling to your formula like this:
    =IF(ISERROR(Sheet1!A1=0),"",Sheet1!A1)
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

Posting Permissions

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