View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Biff
 
Posts: n/a
Default If's conditions about matching

Actually the formula does work....When adjusting for screen wrapping

OK, works just fine. Dang line wrap!

"paid in cashews"


Is that like working for peanuts? I have experience in that area!

I like your modified version, padding with spaces, to cure the cashews
problem.

Biff

"Ron Coderre" wrote in message
...
Hi, Biff

Actually the formula does work....When adjusting for screen wrapping, a
space character is inadvertently eliminated from the 2nd COUNTIF function,
causing the error you noticed. Broken into 4 pieces, this is the formula:

B1: =INDEX({"NO","START","MIDDLE","END"},
COUNTIF($A1,$C$1&"*")*2
+COUNTIF($A1,"* "&$C$1&" *")*3
+COUNTIF($A1,"* "&$C$1)*4)

That being said....I prefer your shorter formula; it's more concise.

Amusing that both formulas have different issues with various placements
of
"paid in cashews" <g

***********
Best Regards,
Ron

XL2002, WinXP


"Biff" wrote:

4)Whether the phrase appears at the start, in the middle, or at the end
of
the
statement
B1:
=INDEX({"NO","START","MIDDLE","END"},COUNTIF($A1,$ C$1&"*")*2+COUNTIF($A1,"*
"&$C$1&" *")*3+COUNTIF($A1,"* "&$C$1)*4)


Returns #REF! when A1 = paid by cash in person

A few keystrokes shorter and maybe less complicated:

C1 = paid by cash

=IF(ISNUMBER(SEARCH(C1,A1)),IF(SEARCH(C1,A1)=1,"St art",IF(RIGHT(A1,LEN(C1))=C1,"End","Middle")),"")

Biff

"Ron Coderre" wrote in message
...
Try these:

For text in A1

1)If the first letter of the statement is "A" or number "2"
B1: =IF(OR(LEFT(A1,1)={"A","2"}),"YES","NO")

2)If the second word of the statement is "join" or "joins" or "joined"
Maybe this:
B1: =IF(ISNUMBER(SEARCH("join",A1,SEARCH(" ",A1))),"YES","NO")
Note: this one will also match on "joint". Is that ok?

3)If there's a phrase (eg paid by cash) in the statement
B1: =IF(ISNUMBER(SEARCH("paid in cash",A1)),"YES","NO")

4)Whether the phrase appears at the start, in the middle, or at the end
of
the
statement
B1:
=INDEX({"NO","START","MIDDLE","END"},COUNTIF($A1,$ C$1&"*")*2+COUNTIF($A1,"*
"&$C$1&" *")*3+COUNTIF($A1,"* "&$C$1)*4)

Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"0-0 Wai Wai ^-^" wrote:


How can I code these if's conditions:

1)
If the first letter of the statement is "A" or number "2"

2)
If the second word of the statement is "join" or "joins" or "joined"

3)
If there's a phrase (eg paid by cash) in the statement

4)
Whether the phrase appears at the start, in the middle, or at the end
of
the
statement

The position of the phrase:
Statement 1: {phrase}... ... [start]
Statement 2: ...{phrase}... [middle]
Statement 3: ... ...{phrase} [end]


Thank you!

--
Additional info about my computer:
- Office XP
- Windows XP Pro