Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Cell Filtering with conditions
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Cell Filtering with conditions
Hi Chip,
Thanks for your help, and your function does work, but it seems to only return the first incident of condition. I was hoping to retrieve all results that match this condition ("_")with the cell. Is there a way this function could be modified? thanks again, Craig Freeman |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Countif Conditions - Use of conditions that vary by cell value | Excel Discussion (Misc queries) | |||
Conditional formatting Based on cell A text with conditions in Cell B | Excel Discussion (Misc queries) | |||
Filtering Referenced Cell | Excel Discussion (Misc queries) | |||
filtering based on a value in a cell | Excel Worksheet Functions | |||
trouble filtering a list. Why isn't column filtering? | Excel Worksheet Functions |