IF Function with ISBLANK

S

Steve M

Hello,
I'm hoping someone can figure this out. I am trying to add a value to
B1 using the following:
I started out with =IF(ISBLANK(A1),"",8)
A1 will either be blank or contain a date. As an example I want to
change the above so that if I enter in A1 the date of May-7x the the
value in B1 will return a 4. And if I enter the date of May-7z into
A1 then the value returned in B1 should be 8.

So to summarize, B1 should either be blank, contain a 4 or contain an
8. I think the key is that I need to define a wild card (if possible)
to look for either the 'x' at the end of the date to bring back '4' or
a 'z' at the end of the date to bring back an '8'.

Its a bit confusing to explain, hopefully you can understand.

-Thanks
 
A

akphidelt

Try something like this

=If(Len(A1)<1,"",If(Right(A1,1)="x",4,If(Right(A1,1)="z",8,"Error")))
 
T

T. Valko

I think the key is that I need to define a wild card (if possible)
to look for either the 'x' at the end of the date to bring back
'4' or a 'z' at the end of the date to bring back an '8'.

Yes, that's exactly what you need to do. Are "x" and "z" genreric
placeholders or do you want to look for literal "x" or "z" ?

If they're generic placeholders then they need to be defined somehow.
 
S

Steve M

Biff,
"x" or "z" are literal. I figured I needed to define a consistent
value to check for. I'm not sure how to use the wild card so I could
use some help on that.

-Thanks
 
S

Steve M

Is it possible to modify this so that if I enter the date with an x it
will return a value of 4 and if I enter just the date alone it will
return a value of 8? The 8 will be the most used value so if I could
have it so that I can use the x as a 'switch' to change the value to 8
then this would work best. I would still need the default to be
blank.

-thanks again
 
A

akphidelt

no problem, if you have any more information on what exactly you want to do
let me know. In case this doesn't solve all your problems for this particular
situation.
 
T

T. Valko

I see 'akphidelt' addressed the literal values.

--
Biff
Microsoft Excel MVP


Steve M said:
Biff,
"x" or "z" are literal. I figured I needed to define a consistent
value to check for. I'm not sure how to use the wild card so I could
use some help on that.

-Thanks
 
A

akphidelt

Yea, if you have three possible options, 4, 8, and "" then you can set it up
like

=If(Len(A1)<1,"",If(Right(A1,1)="x",4,8))

So this says, hey if there is nothing in the cell, leave it blank... if
there is an x in a cell with something in it, make it 4... if there is
something in a cell with no x then make it 8.
 
S

Steve M

Yea, if you have three possible options, 4, 8, and "" then you can set it up
like

=If(Len(A1)<1,"",If(Right(A1,1)="x",4,8))

So this says, hey if there is nothing in the cell, leave it blank... if
there is an x in a cell with something in it, make it 4... if there is
something in a cell with no x then make it 8.

That is absolutely perfect. Thank you so much.
 

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