#1   Report Post  
DME
 
Posts: n/a
Default IF Statement

IN cell a1 I have CP-Barge

In B1 I want a formula that says IF A1 contains CP then Enter CP into cell
B1otherwise leave it Blank

I have tried =IF(a1="*CP*","CP","") but it does not work.

Thanks for your help


  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

=if(left(a1,2)="CP","CP","")

if A1 always starts with the two characters CP.



DME wrote:

IN cell a1 I have CP-Barge

In B1 I want a formula that says IF A1 contains CP then Enter CP into cell
B1otherwise leave it Blank

I have tried =IF(a1="*CP*","CP","") but it does not work.

Thanks for your help


--

Dave Peterson

  #3   Report Post  
BenjieLop
 
Posts: n/a
Default


DME Wrote:
IN cell a1 I have CP-Barge

In B1 I want a formula that says IF A1 contains CP then Enter CP into
cell
B1otherwise leave it Blank

I have tried =IF(a1="*CP*","CP","") but it does not work.

Thanks for your help


Will this work for you?

=if(left(A1,2)="CP","CP","")


--
BenjieLop


------------------------------------------------------------------------
BenjieLop's Profile: http://www.excelforum.com/member.php...o&userid=11019
View this thread: http://www.excelforum.com/showthread...hreadid=273449

  #4   Report Post  
RagDyer
 
Posts: n/a
Default

Try this:

=IF(ISERR(SEARCH("*CP*",A1)),"","CP")

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================


"DME" <craigjoseathotmaildotcom wrote in message
...
IN cell a1 I have CP-Barge

In B1 I want a formula that says IF A1 contains CP then Enter CP into cell
B1otherwise leave it Blank

I have tried =IF(a1="*CP*","CP","") but it does not work.

Thanks for your help


  #5   Report Post  
Bob Phillips
 
Posts: n/a
Default

If you want it case-sensitive, amend RD's formula to
=IF(ISERR(FIND("CP",A1)),"","CP")

--

HTH

RP

"RagDyer" wrote in message
...
Try this:

=IF(ISERR(SEARCH("*CP*",A1)),"","CP")

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================


"DME" <craigjoseathotmaildotcom wrote in message
...
IN cell a1 I have CP-Barge

In B1 I want a formula that says IF A1 contains CP then Enter CP into cell
B1otherwise leave it Blank

I have tried =IF(a1="*CP*","CP","") but it does not work.

Thanks for your help






  #6   Report Post  
RagDyer
 
Posts: n/a
Default

The problem with using FIND() in this scenario though Bob, is that it
*doesn't* accept wild cards, and to meet the OP's specs, wildcards *are*
necessary.
--


Regards,

RD
--------------------------------------------------------------------
Please keep all correspondence within the Group, so all may benefit!
-------------------------------------------------------------------

"Bob Phillips" wrote in message
...
If you want it case-sensitive, amend RD's formula to
=IF(ISERR(FIND("CP",A1)),"","CP")

--

HTH

RP

"RagDyer" wrote in message
...
Try this:

=IF(ISERR(SEARCH("*CP*",A1)),"","CP")

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================


"DME" <craigjoseathotmaildotcom wrote in message
...
IN cell a1 I have CP-Barge

In B1 I want a formula that says IF A1 contains CP then Enter CP into cell
B1otherwise leave it Blank

I have tried =IF(a1="*CP*","CP","") but it does not work.

Thanks for your help




  #7   Report Post  
Bob Phillips
 
Posts: n/a
Default

Why? FIND finds it wherever it is (as does SEARCH). The OP used wildcards,
but I don't see that makes it a requirement. Am I missing something?

--

HTH

RP

"RagDyer" wrote in message
...
The problem with using FIND() in this scenario though Bob, is that it
*doesn't* accept wild cards, and to meet the OP's specs, wildcards *are*
necessary.
--


Regards,

RD
--------------------------------------------------------------------
Please keep all correspondence within the Group, so all may benefit!
-------------------------------------------------------------------

"Bob Phillips" wrote in message
...
If you want it case-sensitive, amend RD's formula to
=IF(ISERR(FIND("CP",A1)),"","CP")

--

HTH

RP

"RagDyer" wrote in message
...
Try this:

=IF(ISERR(SEARCH("*CP*",A1)),"","CP")

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================


"DME" <craigjoseathotmaildotcom wrote in message
...
IN cell a1 I have CP-Barge

In B1 I want a formula that says IF A1 contains CP then Enter CP into

cell
B1otherwise leave it Blank

I have tried =IF(a1="*CP*","CP","") but it does not work.

Thanks for your help






  #8   Report Post  
RagDyer
 
Posts: n/a
Default

You're not missing anything!
It's me who's missing brain power.<g

Funny how that power of suggestion can throw you off.
--


Regards,

RD
--------------------------------------------------------------------
Please keep all correspondence within the Group, so all may benefit!
-------------------------------------------------------------------

"Bob Phillips" wrote in message
...
Why? FIND finds it wherever it is (as does SEARCH). The OP used wildcards,
but I don't see that makes it a requirement. Am I missing something?

--

HTH

RP

"RagDyer" wrote in message
...
The problem with using FIND() in this scenario though Bob, is that it
*doesn't* accept wild cards, and to meet the OP's specs, wildcards *are*
necessary.
--


Regards,

RD
--------------------------------------------------------------------
Please keep all correspondence within the Group, so all may benefit!
-------------------------------------------------------------------

"Bob Phillips" wrote in message
...
If you want it case-sensitive, amend RD's formula to
=IF(ISERR(FIND("CP",A1)),"","CP")

--

HTH

RP

"RagDyer" wrote in message
...
Try this:

=IF(ISERR(SEARCH("*CP*",A1)),"","CP")

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================


"DME" <craigjoseathotmaildotcom wrote in message
...
IN cell a1 I have CP-Barge

In B1 I want a formula that says IF A1 contains CP then Enter CP into

cell
B1otherwise leave it Blank

I have tried =IF(a1="*CP*","CP","") but it does not work.

Thanks for your help






  #9   Report Post  
maryj
 
Posts: n/a
Default

This is what I need except I needed it nested for several text possibilities.
For example, I need it to find "apples", "oranges", "bananas" or "grapes". I
need the wildcards because these words could be anywhere in a cell.

"RagDyer" wrote:

Try this:

=IF(ISERR(SEARCH("*CP*",A1)),"","CP")

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================


"DME" <craigjoseathotmaildotcom wrote in message
...
IN cell a1 I have CP-Barge

In B1 I want a formula that says IF A1 contains CP then Enter CP into cell
B1otherwise leave it Blank

I have tried =IF(a1="*CP*","CP","") but it does not work.

Thanks for your help



  #10   Report Post  
JulieD
 
Posts: n/a
Default

Hi maryj

if it finds "apples" do you want "apples" in B1; if it finds "oranges" do
you want "oranges" in B1 etc?

If so then one option is
=IF(ISERR(SEARCH("*CP*",A1)),IF(ISERR(SEARCH("*app les*",A1)),IF(ISERR(SEARCH("*oranges*",A1)),IF(ISE RR(SEARCH("*bananas*",A1)),IF(ISERR(SEARCH("*grape s*",A1)),"","grapes"),"bananas"),"oranges"),"apple s"),"CP")

Cheers
JulieD

"maryj" wrote in message
...
This is what I need except I needed it nested for several text
possibilities.
For example, I need it to find "apples", "oranges", "bananas" or "grapes".
I
need the wildcards because these words could be anywhere in a cell.

"RagDyer" wrote:

Try this:

=IF(ISERR(SEARCH("*CP*",A1)),"","CP")

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================


"DME" <craigjoseathotmaildotcom wrote in message
...
IN cell a1 I have CP-Barge

In B1 I want a formula that says IF A1 contains CP then Enter CP into
cell
B1otherwise leave it Blank

I have tried =IF(a1="*CP*","CP","") but it does not work.

Thanks for your help







  #11   Report Post  
maryj
 
Posts: n/a
Default

Perfect!! That's just what I needed.

"JulieD" wrote:

Hi maryj

if it finds "apples" do you want "apples" in B1; if it finds "oranges" do
you want "oranges" in B1 etc?

If so then one option is
=IF(ISERR(SEARCH("*CP*",A1)),IF(ISERR(SEARCH("*app les*",A1)),IF(ISERR(SEARCH("*oranges*",A1)),IF(ISE RR(SEARCH("*bananas*",A1)),IF(ISERR(SEARCH("*grape s*",A1)),"","grapes"),"bananas"),"oranges"),"apple s"),"CP")

Cheers
JulieD

"maryj" wrote in message
...
This is what I need except I needed it nested for several text
possibilities.
For example, I need it to find "apples", "oranges", "bananas" or "grapes".
I
need the wildcards because these words could be anywhere in a cell.

"RagDyer" wrote:

Try this:

=IF(ISERR(SEARCH("*CP*",A1)),"","CP")

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================


"DME" <craigjoseathotmaildotcom wrote in message
...
IN cell a1 I have CP-Barge

In B1 I want a formula that says IF A1 contains CP then Enter CP into
cell
B1otherwise leave it Blank

I have tried =IF(a1="*CP*","CP","") but it does not work.

Thanks for your help






  #12   Report Post  
JulieD
 
Posts: n/a
Default

you're welcome and thanks for the feedback

"maryj" wrote in message
...
Perfect!! That's just what I needed.

"JulieD" wrote:

Hi maryj

if it finds "apples" do you want "apples" in B1; if it finds "oranges" do
you want "oranges" in B1 etc?

If so then one option is
=IF(ISERR(SEARCH("*CP*",A1)),IF(ISERR(SEARCH("*app les*",A1)),IF(ISERR(SEARCH("*oranges*",A1)),IF(ISE RR(SEARCH("*bananas*",A1)),IF(ISERR(SEARCH("*grape s*",A1)),"","grapes"),"bananas"),"oranges"),"apple s"),"CP")

Cheers
JulieD

"maryj" wrote in message
...
This is what I need except I needed it nested for several text
possibilities.
For example, I need it to find "apples", "oranges", "bananas" or
"grapes".
I
need the wildcards because these words could be anywhere in a cell.

"RagDyer" wrote:

Try this:

=IF(ISERR(SEARCH("*CP*",A1)),"","CP")

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================


"DME" <craigjoseathotmaildotcom wrote in message
...
IN cell a1 I have CP-Barge

In B1 I want a formula that says IF A1 contains CP then Enter CP into
cell
B1otherwise leave it Blank

I have tried =IF(a1="*CP*","CP","") but it does not work.

Thanks for your help








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Report Using IF Statement? Marc Excel Discussion (Misc queries) 3 January 11th 05 07:38 AM
IF Statement with Average Function results in #Value! Paul Excel Discussion (Misc queries) 5 December 28th 04 08:11 AM
when writing an IF statement what is the syntax for "Not Equal to. NEEDTOKNOW Excel Discussion (Misc queries) 1 December 10th 04 04:32 PM
Combining SUM Function with Nested If Statement Somecallmejosh Excel Discussion (Misc queries) 3 December 6th 04 04:25 PM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM


All times are GMT +1. The time now is 10:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"