View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default Trouble with conflicting IsBlank() and CountBlank() results

Not sure I follow you:
=IF(ISBLANK(A1),"",A1)

The above formula will put an empty string in the formula cell, if
ISBLANK(A1) is true, else it will return the value of A1 othere than blank
or empty string. So if you are getting "" in C1, you are getting the
correct return.

I don't work with formulas a lot but it seems like I read somewhere that
Excel had some quirks with the IsBlank in respect to the empth string ("").
I know that in VBA IsEmpty and the empty string and zero have distinctive
differences, so care has to be taken in what one tests for.

Testing for values greater than zero can sometimes work better than testing
for blanks.




"Rich" wrote in message
...
I'm using the following formula in cell c1:
=if(isblank(a1),"",a1)
to "copy" the a1 cell value to cell c1 without displaying a zero if a1 is
blank.

The trouble I'm having is if cell a1 is blank, thus making the value of c1
=
""....
=isblank(c1) returns false (the cell is not blank), but...
=countblank(c1) returns 1 (the cell is blank)

Why does CountBlank consider a cell with the value of "" as blank, but
IsBlank does not??

I found this apparent discrepany in results because I actually want to use
CountA(c1:c4) to count non-blank cells, but it's count cells with a value
of
"" as a non-blank cell.

I know I can "work around" this by using 4-countblank(c1:c4) to find the
number of non-blank cells, but I like the direct route better.

Is there a better way to copy a blank value from a1 to c1??