View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default VBA Cell Filtering with conditions

Craig,

Try the following function:

Function ParseIt(S As String) As String

Dim Ndx As Long
Dim Arr As Variant
Arr = Split(S, " ")
For Ndx = LBound(Arr) To UBound(Arr)
If Left(Arr(Ndx), 1) = """" And Right(Arr(Ndx), 1) = """"
Then
If InStr(Arr(Ndx), "_") 0 Then
ParseIt = Arr(Ndx)
Exit Function
End If
End If
Next Ndx

End Function

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Craig Freeman" wrote in message
om...
Hello,

Is there way to have Excel retain everything in a cell that is
between
quotation marks ("") and contains an underscore ( _ ) and
delete
everything else that does not match this condition. I'd like
the
results returned to the column/cell beside the original. The
cell
character length is greater that 255 (limitation of countif)?
I'm
analyzing SQL statements.

For example: (keep in mind, this example has less than 255
characters
per cell, but I need this to work for cell over 255 characters)

A1
"dog" cat "horse_mule" pig

would return

B1
"horse_mule"


Again, any suggestions/solutions would be greatly appreciated.