Help on If-Statement

W

wj

Hi,

I need an if-statement function for the following scenario:

formula in J2: If cell C2 contains word "attn", copy the entire text string
to K2.

Thanks!
 
J

JE McGimpsey

One way:

K2: =IF(COUNTIF(C2,"*attn*"),C2,"")

Note that a formula in J2 can't do anything other than return a value to
J2 - it can't put a value in another cell, so the formula needs to be
entered in K2.
 
P

Peo Sjoblom

A formula must return its result in the same cell that holds the formula,
so if you want the string in K2 you would need the formula there or you
would
need to use VBA

--
Regards,

Peo Sjoblom

(No private emails please, for everyone's
benefit keep the discussion in the newsgroup/forum)
 
W

wj

Hi

Thanks!

How can I add 1 more condition in K2 to include both "attn" or "att"?
Is it possible to delete text string after it was copied to K2?
 
B

Biff

Just change the formula to:

=IF(COUNTIF(C2,"*ATT*"),C2,"")

The * are wildcards meaning anything can preceed the "A"
or follow the "T", so both conditions - ATT or ATTN will
be met.
Is it possible to delete text string after it was copied
to K2?

Not sure what you mean by that...but if the formula is in
K2, deleting the text string also deletes the formula.

Biff
 

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