Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
strings
Hi, In range("a1") I have '20 Points - 5 Card Charlie' or '20 Points -
Black Jack'. The 'x Points -' can be any number. How do I ask in vba does the sting contain '5 Card Charlie' or 'Black Jack' Regards Robert |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
strings
one way:
=if(countif(a1,"*5 card charlie*")0,"Found it","nope") or =if(isnumber(search("5 card charlie",a1)),"yep","nope") You could use Find (instead of Search) if you wanted case sensitive results. RobcPettit wrote: Hi, In range("a1") I have '20 Points - 5 Card Charlie' or '20 Points - Black Jack'. The 'x Points -' can be any number. How do I ask in vba does the sting contain '5 Card Charlie' or 'Black Jack' Regards Robert -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
strings
Thankyou for your reply. This is great for in the worksheet, but i need
to do it in vba. Regards Robert Dave Peterson wrote: one way: =if(countif(a1,"*5 card charlie*")0,"Found it","nope") or =if(isnumber(search("5 card charlie",a1)),"yep","nope") You could use Find (instead of Search) if you wanted case sensitive results. RobcPettit wrote: Hi, In range("a1") I have '20 Points - 5 Card Charlie' or '20 Points - Black Jack'. The 'x Points -' can be any number. How do I ask in vba does the sting contain '5 Card Charlie' or 'Black Jack' Regards Robert -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
strings
Solved it. Used
If InStr(Range("c13"), "5 Card Charlie") Then charlie = "5CC" Else charlie = "" End If Thankyou Regards Robert |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
strings
Oops. Sorry about missing the VBA stuff.
You may want to use something like: If InStr(1, ActiveSheet.Range("c13").Value, _ "5 card charlie", vbTextCompare) 0 Then if you don't care about case. (and I like to qualify my ranges...) RobcPettit wrote: Solved it. Used If InStr(Range("c13"), "5 Card Charlie") Then charlie = "5CC" Else charlie = "" End If Thankyou Regards Robert -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
find and replace numeric strings in larger text strings | Excel Worksheet Functions | |||
How to find number of pairs of strings from list of strings? | Excel Worksheet Functions | |||
How can I count strings within strings | Excel Worksheet Functions | |||
Finding strings within strings | Excel Programming | |||
Finding strings within strings | Excel Programming |