How can I remove duplicate data in datatable with using condition in columns

Hi , Anyone

I need some suggestion about datatable.
I have excel file and get data in datatable as DT1.

How can I change DT1 to DT2 as

If DT1.Type = “Entry” then DT2.EntryDate = DT1.Date
If DT1.Type = “Expired” then DT2.ExpiredDate = DT1.Date

First step I use For Each Row but for the next step I don’t know how to design logic.
Please Suggest.

With group By we can identify the rows belonging to a person
From the group we can extract the Entry Date / Expire Date from the group members

Have a look here:


Another approch using For Each Row activity (9.5 KB)

Hope this may help you


I can’t open your example because my robot version is not support.
Could you please capture activities that missing?


Check as below

Place Read Range activity and read the sheet as DT1 and DT2

Once done place For Each row activity and declare a variable for Index in Properties

Inside that place a Filter Datatable activity as below

Once done Place a If condition and write


In Assign I wrote as below

dt2.rows(index).Item(“Entry Date”) = Convert.ToDateTime(tempDt.Rows(0).Item(“Date”).ToString).ToString(“dd/MM/yyyy”)

Next place another Filter Datatable as below

And place another if condition

As same as above but the Assign I write as below

dt2.rows(index).Item(“Expired Date”) = Convert.ToDateTime(tempDt.Rows(0).Item(“Date”).ToString).ToString(“dd/MM/yyyy”)

Now outside of the For Each loop activity place write range activity and pass DT2 datatable

So you will see the structure as below

Hope this may help you


Many thanks your help. :slight_smile:

1 Like

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