Excel/Datatable Remove ALL Row with duplicate colums

Hi,
i have a table like this
|A|B|C|
|1|test1|AAA|
|2|test2|AAA|
|3|test3|BBB|
|4|test4|CCC|

I would like to delete the rows that have the same value in column C
Result:
|A|B|C|
|3|test3|BBB|
|4|test4|CCC|

I have a larghe excel file,
I wouldn’t scroll through the whole file

Thanks

@d_liberati
find starter help here
FindDupsUniquesFirstFromGroup_By1Col.xaml (8.4 KB)

1 Like

Thanks
but it doesn’t work, where do I indicate that I want duplicates of column C?

the demo xaml was tested multiple times by different people on different machines. Can you help us to understand your feedback: Is the test xaml not working at your end or is the integration / adoption into your implementation not working?

I have 1 datatable like this:

|colum1|colum2|colum3|colum4|
|1 |test1 |AAA |sasa
|2 |test2 |AAA |ffgr
|3 |test3 |BBB |ggr
|4 |test4 |CCC |grrgr

i’d like to have 1 output datatable like this, based on duplicate values of colum3:

|colum1|colum2|colum3|colum4|
|3 |test3 |BBB |ggr
|4 |test4 |CCC |grrgr

Thanks

please do not give a repetition of your case when a question was send to you:
was the demo xaml running at your end or not?

Sorry,
the Demo running demo but I don’t have the expected result

@d_liberati, mind sharing your excel file?

unfortunately I can’t, it has many lines and contains sensitive customer data

Hi @d_liberati,

Take a look this one

Regards
Balamurugan.S

1 Like

well then creat an example that looks exactly like what you want, and share that instead.

@d_liberati
from demo data
grafik

the case dtNonDuplicates is matching to your scenario
grafik

this is to inspect with setting breakpoints, debugging and watching the locals in the locals panel

so taking the statement from demo
(From d In dtData
Group d By k=d(0).toString.Trim Into grp=Group
Where grp.Count =1
Select grp.First()).CopyToDatatable

and adopting to your variablenames and columnname or index like

(From d In YourDataTableVar
Group d By k=d(“C”).toString.Trim Into grp=Group
Where grp.Count =1
Select grp.First()).CopyToDatatable

should work

Using the component from @balupad14 also is first stop to explore if a scenario can be solved with this as the component is very powerfull

1 Like

This delete only duplicate, but i need to delete the 2 rows of duplicate set.

Thanks

@d_liberati
Your sample data
grafik

filtered with
(From d In dtData
Group d By k=d(2).toString.Trim Into grp=Group
Where grp.Count =1
Select grp.First()).CopyToDatatable

with the result on dtNonDuplicates
grafik

when you compair with the posts from above it is similar /same code base

Find demo here:
d_liberati.xaml (7.6 KB)

2 Likes

Thanks,
it Work Fine !!!

it is possible to have another Datatable with only duplicate rows
dtOnlyDuplicates=

image

yes it is also present in the demo.

Give a try in your case with:
(From d In dtData
Group d By k=d(2).toString.Trim Into grp=Group
Where grp.Count >1
Select grp.toList).SelectMany(Function (x) x).CopyToDatatable

in the demo xaml: case dtDuplicatesOnly

RemoveAllRowsWithDuplicateColumn.xaml (9.3 KB)

Try this .!

Thanks!

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