Equal "" when zero has a space after it

G

Guest

I hope this makes sense. I am referencing a cell that has "0 " - or zero with
a space after it. My intent is for example:

A1=0 - In cell b1 I would type =if(a1=0,"",a1)
or
A1=0 (there is a space after it in this instance) - In b1 I type
if(a1=0,"",if(a1=0 ,"",a1)

Does this make sense? It's not recognizing the space after the zero somehow.
I want the "zero with the space after it" yield "" or blank or nothing.
Thanks for your help on this.
 
T

T. Valko

Does this make sense?

To be honest, no. But here's what you asked for (sort of!):

=IF(A1=0,"",IF(A1="0 ",A1,-----)

The ----- represents the undefined Value_If_False argument for when A1 is
neither 0 or "0 ". If you leave out that agrument it will default to FALSE:

=IF(A1=0,"",IF(A1="0 ",A1)
 
T

T. Valko

I think I got confused on this.

Let's see if this is what you want:

If A1 = 0 *or* "0 " then return blank ("") otherwise return A1.

If that's what you want:

=IF(OR(A1=0,A1="0 "),"",A1)
 
P

Peo Sjoblom

Another way

=IF(TRIM(A1)="0","",A1)

works if there are more than one trailing space as well
 
D

Dallman Ross

T. Valko said:
Let's see if this is what you want:

If A1 = 0 *or* "0 " then return blank ("") otherwise return A1.

If that's what you want:

=IF(OR(A1=0,A1="0 "),"",A1)

I'm left wondering if the OP has a space merely because he
wants it there for nice formatting purposes. If that is the
case, I'd suggest to him to remove the space and use formatting
options to put "space" there instead. E.g., format as type
"Accounting" is one easy way to get there.)
 
H

Harlan Grove

Peo Sjoblom said:
Another way

=IF(TRIM(A1)="0","",A1)

works if there are more than one trailing space as well
....

Unless " 0", " 0", "0 ", "0 ", etc. should be treated differently, in
which case it doesn't work.
 

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