ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Find a character in a textstring (https://www.excelbanter.com/excel-discussion-misc-queries/112007-find-character-textstring.html)

Vix

Find a character in a textstring
 
I would like to find a character (in my case the letter S) in a list of
textstrings,
and then return the textstrings containing "S" , as well as the two other
columns that correspond to it .

My columns are as follows

36359 LP 21227.78
36360 FLS 16218.75
36361 FS 14471.59
36362 FS 30109.59
36363 FS 7801.26
36364 FAP 29816.75
36365 FLS 16875

So if I wanted to search for "S" in column 2, I would return;

36360 FLS 16218.75
36361 FS 14471.59
36362 FS 30109.59
36363 FS 7801.26
36365 FLS 16875


JMB

Find a character in a textstring
 
Data/Filter/Autofilter. Click the drop arrow in column 2, select custom.
Then Show rows where column 2 "contains" S.


"Vix" wrote:

I would like to find a character (in my case the letter S) in a list of
textstrings,
and then return the textstrings containing "S" , as well as the two other
columns that correspond to it .

My columns are as follows

36359 LP 21227.78
36360 FLS 16218.75
36361 FS 14471.59
36362 FS 30109.59
36363 FS 7801.26
36364 FAP 29816.75
36365 FLS 16875

So if I wanted to search for "S" in column 2, I would return;

36360 FLS 16218.75
36361 FS 14471.59
36362 FS 30109.59
36363 FS 7801.26
36365 FLS 16875


Toppers

Find a character in a textstring
 
A VBA solution:

Sub x()
Dim rng2 As Range
Set rng2 = Sheets("sheet2").Range("A2")
With Sheets("Sheet1")
lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
For r = 2 To lastrow
If InStr(1, .Cells(r, "B"), "S") < 0 Then
.Cells(r, "A").Resize(, 3).Copy rng2
Set rng2 = rng2.Offset(1, 0)
End If
Next r
End With
End Sub

"JMB" wrote:

Data/Filter/Autofilter. Click the drop arrow in column 2, select custom.
Then Show rows where column 2 "contains" S.


"Vix" wrote:

I would like to find a character (in my case the letter S) in a list of
textstrings,
and then return the textstrings containing "S" , as well as the two other
columns that correspond to it .

My columns are as follows

36359 LP 21227.78
36360 FLS 16218.75
36361 FS 14471.59
36362 FS 30109.59
36363 FS 7801.26
36364 FAP 29816.75
36365 FLS 16875

So if I wanted to search for "S" in column 2, I would return;

36360 FLS 16218.75
36361 FS 14471.59
36362 FS 30109.59
36363 FS 7801.26
36365 FLS 16875



All times are GMT +1. The time now is 12:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com