Help on If-Statement

  • Thread starter Thread starter wj
  • Start date Start date
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!
 
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.
 
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)
 
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?
 
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
 
Back
Top