Delete data rows based on column values

Hello, I would like to delete data rows based on the value in column A.example
Thats my data table, I would like to delete the data rows that have the values 2, -2, 5 and -5 in column A . Thanks in advance :slight_smile:

Use Read Range DT1
Then Use Filter Datatable Activity
In that use Remove Rows
Input Will be DT1
Output Will be DT2
Use Condition
Column Name which is A in your requirement
Use condirtion
“ColumnName” = “-2”
OR
“ColumnName” = “2”
OR
“ColumnName” = “5”
OR
“ColumnName” = “-5”

Then write range DT2 in sheet 2

1 Like

Hi,

If you want to change number of conditions, the following helps you.

img20200526-2

dt.AsEnumerable.Where(function(r) not arrInt.Contains(CInt(r("ColumnA").toString))).CopyToDataTable()

Regards,

2 Likes

Hi Yoichi, thank you for your response. I have tried using your suggested solution but there is a slight challenge. Is there a maximum number of data rows that can be processed? It seems like some but not all the data rows that meet the condition were deleted. my data table has a total of 20 100 rows

Actually it looks like none of the data rows are being deleted. Not sure if i am doing something wrong

RawDataTable.AsEnumerable.Where(Function(r) Not arrStr.Contains(CStr(r(5).toString))).CopyToDataTable()

Blockquote

RawDataTable.AsEnumerable.Where(Function(r) Not arrStr.Contains(CStr(r(5).toString))).CopyToDataTable()

Hi, it worked :smile: after i started using headers in my table! Thank you so much

1 Like

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