View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default Formula help needed

Ostensibly, put the following into C1 and D1, then copy down:

C1: =if(isnumber(search("EX",A1)), B1, "")

D1: =if(isnumber(search("ENT",A1)),B1,"")

Caveats:

1. SEARCH is case-insensitive; for example, it will match "ex" as well as
"EX". If you prefer not to match lowercase, use FIND instead of SEARCH.

2. This will match "EX" or "ENT" contained anywhere, an apparent requirement
given your examples. But consider the following ambiguity in A1: ENT
EX51B1A1. The formulas above will yield the same value in both C1 and D1.

There is no solution for #2 unless you qualify the syntactic requirements.
For example, if EX or ENT can only appear in the left or right of the text,
and they will never appear in both left and right, then the following might
suffice:

C1: =if(or(left(A1,2)="ex", right(A1,2)="ex"), B1, "")

D1: =if(or(left(A1,3)="ent", right(A1,3)="ent"), B1, "")

Again, those formulas are case-insensitive.


----- original message -----

"Jeremy" wrote in message
...
I am looking for a formula to place what is in B in either C or D based off
of if A has an EX or ENT in it. EX goes in C where ENT goes in D. Below
the
first example is what I have and the second is what I would like.

Thank you



A B C D
1 CGVEHEX 1500
2 ENTB2A0 2500
3 EX NM51B1A1 2600
4 ENT W NM 2780

Example 2
A B C D
1 CGVEHEX 1500 1500
2 ENTB2A0 2500 2500
3 EX NM51B1A1 2600 2600
4 ENT W NM 2780 2780