Filter out Data table question

In filter datatable, I need to filter out values “S1” Or “S2” to S10. That is with one or two digits after S. Is there a way to specify this rule?

Thanks much,

Hi @A_Learner,

Could you elaborate a little more on what exactly you want to do?


Col1 has values like “ABC-S1”, “ABC-S2”, “XYZ-SEER”. So I need to remove rows with Col1 ending with “S1”, that is S and a digit.

Thank you,


did you mean something like this?



Yes, do I have to list all S1 to S10?

Thank you,

You can use this.

do a while loop and the filter with that

FilteredDT = dt.AsEnumerable.Where(function(x) x("yourColumn").ToString.Trim.ToLower.Contains("S" + Counter.ToString)).CopyToDataTable


1 Like

Thank you!! @fernando_zuluaga

1 Like

But I need to eliminate these rows.

FilteredDT = dt.AsEnumerable.Where(function(x) Not(x("yourColumn").ToString.Trim.ToLower.Contains("S" + Counter.ToString))).CopyToDataTable

add “not” at the end of the function

Got it! Thanks @fernando_zuluaga, @muhammedyuzuak

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.