How do get the LOOKUP function to not read empty cells as zeros

L

LGriffin

I am trying to reverse code 0s and 1s with =LOOKUP (reference cell,
{0,1},{1,0}). When the reference cell is empty, I'd like the function to
also return an empty cell.
 
J

JoeU2004

LGriffin said:
I am trying to reverse code 0s and 1s with =LOOKUP (reference cell,
{0,1},{1,0}). When the reference cell is empty, I'd like the function to
also return an empty cell.

=if(A1="","",if(A1,0,1))

treats all non-zero A1 as 1, changing them to 0.

A formula cannot "return an empty cell". It can only make a cell __appear__
blank by returning a null string.

For that reason, use A1="", not ISBLANK(A1), to test for a blank cell.
ISBLANK() returns true only when the cell is truly empty -- that is, no
formula and no value. A1="" returns true in that case as well as when the
value in A1 is the null string, such as the result of IF() expression like
the above.
 
J

JoeU2004

Shane Devenshire said:
=IF(A1=0,1,IF(A1=1,0,""))

Returns 1 when A1 is empty. But the OP wrote: "When the reference cell is
empty, I'd like the function to also return an empty cell".

Of course, a formula cannot "return an empty cell". But it can return a
null string.


----- original message -----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top