53

Is there any way I can check whether a cell is empty?

There is a function ISBLANK() but it returns false when there's a formula in a cell even thought the formula doesn't return anything (or an empty string).

I would like it to return true when the formula doesn't return anything as well. So the cell seems to be empty without any value.

migrated from superuser.com Jul 1 '11 at 16:51

This question came from our site for computer enthusiasts and power users.

45

You can check whether a cell is empty or not by using the following formula:

=if(C2="";"The cell is empty";"The cell is not empty")
  • 2
    Thanks. This one is simpler than mine. It was obviously too trivial for me to think of it. :) – Robert Koritnik Dec 1 '09 at 13:35
  • I believe the real answer is actually to fix the original formula in the cell being tested. I suggest the formula is not actually returning an empty string. Place this formula in cell A1: =if(1=1,"","No Way") and it puts a value into the cell. Unlike Excel, place this one in cell A2: =if(1=1, ,"No Way") and it will leave the cell blank. This is easily tested by placing these formulas in 2 other cells: =ISBLANK(A1) will return FALSE while =ISBLANK(A2) will return TRUE. Likewise =ISBLANK(if(1=1, ,"No Way")) return TRUE. – Karl_S Jan 26 '17 at 15:26
  • Wouldn't it just be C2=""? – Solomon Ucko May 25 '18 at 13:03
9

I can use function

=IF(COUNTBLANK(cell:cell)=1;"Blank cell";"Not blank")

that will be one only of the cell is empty.

3

You can wrap the ISBLANK() with a NOT() it basically switches what ever is in it to the opposite of its original result.

=NOT(ISBLANK(A2))

Its checking if A2 is not empty. If it has something in A2 it will give a True result.

NOT - Docs editors Help

  • 1
    How does that help anything? The OP was asking how to determine if a cell is blank which was defined as empty or containing an empty string. – Adrian Jun 20 '15 at 16:40
  • This is the best answer. It's simple and to the point. The OP asked how to CHECK and this does exactly that! – BBking Dec 3 '15 at 22:23
3

I found the function LEN(A1) to be very useful and robust. It also works for cells that contained text that has been deleted. It returns the length of a cell's content and if it returns 0, the cell is empty.

  • IF(NOT(LEN(A1))) or IF(LEN(A1)=0) to check for empty cells
  • IF(LEN(A1)) or IF(LEN(A1)<>0) to check for non-empty cells

I prefer the fist variant because it's easier to read. The number 0 evaluates to FALSE in a boolean check, any positive number evaluates to TRUE.

2

I've searched the internet (Google, search tools, custom range) for references of the ISBLANK function pre-dating the OP's question. The ISBLANK function already existed during the time of asking: ISBLANK reference before 01/12/2009

Therefore this function will suffice:

=IF(ISBLANK(A2)=TRUE;"Blank cell";"Not blank")

There is however one thing to take in consideration:

  • Deleted text, formatted as plain text, isn't empty
  • 1
    Adding some more explanation as to why this answers the question would help. – ChrisF Feb 10 '13 at 23:47
  • 5
    I've already described the problem with isblank() function in my question. It only returns true when cell is actually empty (not having a formula in it either). What I was looking for no content cells if that makes it more clear to you. – Robert Koritnik Feb 12 '13 at 7:42
  • If you add IFERROR(1/0) it will return TRUE. – Jacob Jan Tuinstra Feb 12 '13 at 7:49
  • @RobertKoritnik Forgot to mention you. – Jacob Jan Tuinstra Feb 12 '13 at 8:49
  • @JacobJanTuinstra: Include it where? Division by 0 is always error. – Robert Koritnik Feb 13 '13 at 8:01
1

Except for @Martin Hansen's A (where all four versions return nothing but #N/A for me) two of the above As do distinguish:

a "blank" cell (truly blank OR containing a formula returning `""`)  

from

a "non-blank" cell (whether Text, Numeric, Boolean or other Formula).

They are all however much longer than they need to be if just for the purpose of differentiation. Much of the length is due to the text chosen to notify the condition. Such text is not necessary (I would like it to return true...). A correct A to Is the cell "not-blank" would serve for differentiation (as @CamSyl's interpretation).

However in that case a correct A to Is the cell "blank" would serve equally well (or better, given OP wants true for blank), and that can be achieved with a formula roughly a third of the length of @CamSyl's solution (which does not solve OP's problem anyway).

I recommend a formula of the type:

=A3="" 

(which is all the essence of @Mehper C. Palavuzlar's A without the text).

WA16754

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.