How to delete row,if Positive values found in particular column

I have column “Invoice Number” which has duplicate values, relevant column "Amount " has positive and negative values.
I want to remove row which has positive value in Amount column.
Please help
Demo.xlsx (10.8 KB)

give a try on following

Assign Activity:
LHS: dtFiltered | DataType: DataTable

(From d In YourDataTableVar.AsEnumerable
Group d By k=d("Invoice Number").toString.Trim Into grp=Group
Let grf = If(grp.Count = 1, grp.ToList, grp.Where(Function (x) CInt(x("Amount in rs.").toString.Trim) <= 0).toList)
From g In grf
Order By YourDataTableVar.Rows.IndexOf(g)
Select r = g).CopyToDataTable


thank you for LINQ code but i need “Negative vaules” from “Amount Column” and not duplicate row, (please refer to output sheet in attached sheet) this code is giving output of “Positive values”

thanks for the feedback

did a correction on the provided LINQ and changed from `

= 0 to <= 0`

this is checked within the if - If group count = 1 then take the group, else filter on the group members

1 Like

thank you very much, it worked, I’m new to Linq query, can you please suggestions some blogs or website to learn.

[HowTo] LINQ (VB.Net) Learning Catalogue - Help / Something Else - UiPath Community Forum

thank you

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