Checking for empty

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,834
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I check for emptiness by typing this into the immediate window:

Code:
?IsEmpty(Sheet1.Cells(1,1).Value)

and it returns False

But when I type:

Code:
?Len(Sheet1.Cells(1,1).Value

I get a value of 0!

Can someone tell me what is going on?

Is the worksheet corrupt?
 
You can use the worksheet functions 'CountA' and 'CountBlank' to check a range for cell content.
 
Upvote 0

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
You can use the worksheet functions 'CountA' and 'CountBlank' to check a range for cell conCountA
CountA was the first thing I used and it gave more a value of more than 3.

Countblank though has returned the correct figure, 16381 because there are 16384 columns in Excel and I see 3 cells populated.

But I'm still curious why CountA failed.
 
Last edited:
Upvote 0
CountA was the first thing I used and it gave more a value of more than 3.
CountA will return cells with formulas and non printing characters although they might not display a value.
 
Upvote 0
Solution
CountA will return cells with formulas and non printing characters although they might not display a value.
Thanks.

This worksheet contained data downloaded from a system, so I suspect that might have played a part.
 
Upvote 0
Ah! missed this part - what the sheet contains...

Thanks for sharing outcome.
 
Upvote 0
Thanks.

This worksheet contained data downloaded from a system, so I suspect that might have played a part.
Yes, that happens frequently with downloads from the web. Some non printing characters take exrra effort to identify and eliminate from Excel. Other things to watch for in the downloads is the double quote marks, if they are not ASCII 34. they can cause problems in code.
 
Upvote 0
Yes, that happens frequently with downloads from the web. Some non printing characters take exrra effort to identify and eliminate from Excel. Other things to watch for in the downloads is the double quote marks, if they are not ASCII 34. they can cause problems in code.

abc
FALSE​
FALSE​
FALSE​
TRUE​
TRUE​
TRUE​
FALSE​
TRUE​
TRUE​
FALSE​
TRUE​
=ISBLANK(L1)
0​
0​
0​
1​
1​
1​
1​
1​
1​
1​
1​
=COUNTBLANK(L1)

Thanks.

As can be seen in the screenshot, COUNTBLANK gives the correct answer, unlike ISBLANK.
 
Upvote 0
If Isblank returns False, then the cell is not blank, there is something in it, as shown when you did Ctrl Right Arrow.
What does this return
Excel Formula:
=CODE(G1)
 
Upvote 0
If Isblank returns False, then the cell is not blank, there is something in it, as shown when you did Ctrl Right Arrow.
What does this return
Excel Formula:
=CODE(G1)
#VALUE!

For columns A, B and C, it returns 97, 98 and 99, all other columns returns #VALUE!
 
Upvote 0
What about
Excel Formula:
=UNICODE(G1)
 
Upvote 0

Forum statistics

Threads
1,215,548
Messages
6,125,468
Members
449,230
Latest member
ASBeard

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top