Delete Duplicate Excel Rows Based On One Column

Hello,

I’ve seen many versions of solutions out there for this, but all appear to be overly complicated for what I need.

I have an excel file of addresses with columns “Address”, “City”, State", “Zip”, “Date”.

I want to delete all duplicates within column “Address” keeping the one with the most recent “Date”.

I’ve done the following and got it to work, but it’s looking for complete duplicate rows across all columns which isn’t what I need.

Any suggestions would be very helpful.

Thanks.

Brett

What had you seen so far. We can achieve it e.g. with a Grouping the data (Non LINQ / LINQ approaches) and processing the the group memebrs (Filtering to the most recent date in your case)

Have a look here:

Whenever to implement any of the solutions that have a GroupBy function, I get this:

How do I fix this?

Thanks.

give a try on the query syntax:

dtOutput =

(From d in dtInput.AsEnumerable
Group d by k=d("Adress").toString.Trim into grp=Group
Select r = grp.First()).CopyToDataTable

Similar error which I’ve seen before in my trials thus far: GroupBy not accessible in this context.

grafik

  • give a try on deleting the assign activity and rebuild it from new (we do it when the validation message is not making sense) - feel free to run the xaml stepwise for triggering a compliation before rebuilding.

ensure following:
grafik

2 Likes

I didn’t have the System.Linq nor System.Linq.Expressions namespaces imported. Thanks!

So please do it and give us feedback if the issue is resolved. Thanks

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