Search code examples
google-sheetsgoogle-sheets-formula

In Google Sheets, how do I keep a cell blank based on two other cells' contents?


I want to create a function that subtracts two cells from each other but stays blank if either of those cells are blank.

So far I have this: =IF(ISBLANK(R9)," ",R9-Q9) This works when R9 is blank. The problem is I need the ISBLANK function to reference Q9 AND R9, but I can only input one argument for that type of function.


Solution

  • Try this

     =IF(OR(ISBLANK(R9),ISBLANK(Q9)),,R9-Q9)
    
    • Uses OR function.
    • The second argument of the IF function is empty, instead of returning a TEXT with one space. This way, the cell having the formula will be BLANK if R9 or Q9 are BLANK.