How to remove rows with duplicates (Excel)

Hello,

I have an Excel file that contains 2 columns, A and B. I need to check if I have duplicates in column A and in such a case I need to remove the particular row whose column B contains a certain value.

For instance, in the next table I need to remove the duplicated row in column A that has ‘Bye’ value in Column B:

Column A | Column B
1234 | Hello
32 | Hello
12 | Hello
1234 | Bye

The table will be:

Column A | Column B
1234 | Hello
32 | Hello
12 | Hello

If the values of column B were the same, then any of the rows would be removed.

Thanks.

@username_uipath
find starter help here:
RemoveDups_1Col_SpecificValue.xaml (6.8 KB)

Thank you so much.

I think I have to be more specific with one point. I dont only need to get the ‘Hello’ values of column B.

If we have the following table:

Column A | Column B
1234 | Hello
32 | Bye
12 | Hello
1234 | Bye

The table will be:

Column A | Column B
1234 | Hello
32 | Bye
12 | Hello

I mean I only have to remove:

  • entire duplicated rows
  • if column A of a certain row has the same value than column A of another row, i have to check if any of them has the value ‘Bye’ in column B and remove this row. If both rows have the same value of column B then I have to remove one of them (no matter which one)…

Please, could you inform me if i explained myself properly?

Thank you so much.

@username_uipath
just enrich your sample data with more data and all cases.

  • duplicated rows
  • if column A of a certain row has the same value than column A of another row, i have to check if any of them has the value ‘Bye’ in column B and remove this row. If both rows have the same value of column B then I have to remove one of them (no matter which one)…

then we will will workout a new iteration

Thanks

1 Like

Edit: Ah yes just saw it. Sorry I missread your request. But DefaultView can filter and with that.

I’ll put an example together for you with defaultview

1 Like

Thank you. I think this solution does not work for one of the requests.

  • if column A of a certain row has the same value than column A of another row, i have to check if any of them has the value ‘Bye’ in column B and remove this row. If both rows have the same value of column B then I have to remove one of them (no matter which one)…

Please, could you help me implementing this new request? Thank you very much

I would be so thankful :slight_smile:

Have a look at this…hope this helps.

I tried to not combine multiple Datatables and insterad work in 1 Datatable (might not be the most elegant solution).

What it does:

It checks for the first occurence in ColumnB for “Bye” and removes every row that has “Bye” in it afterwards.


Edit: Just saw you also have to filter Dupicates from Column A.
You can duplicate the posted workflow and write everything from Column B to Column A and your searchterm like “Bye” needs to be replaces with “1234” like in your example.

Just make sure to put an Assign [indexRow = 0] in between,

RowFilter

FilterRow.zip (9.8 KB)

@username_uipath
input:
grafik

Cases:
1234: group with a Bye to remove
32: duplicates in group, get only 1 time 32
12: single member in group
58: duplicates with only Bye, 1 member to keep
57: single member in group, keep it also as it has value Bye

output:
grafik

find demo xaml here:
RemoveDups_1Col_SpecificValue.xaml (7.7 KB)

1 Like

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