# 重複行の削除について

**URL:** <https://forum.uipath.com/t/topic/348564>\
**Category:** フォーラム\
**Created:** [September 27, 2021, 8:12am UTC](https://forum.uipath.com/t/topic/348564 "2021-09-27T08:12:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nara1](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nara1/32/178184_2.png) [@nara1](https://forum.uipath.com/u/nara1)\
**Post date:** [September 27, 2021, 8:12am UTC](https://forum.uipath.com/t/topic/348564/1 "2021-09-27T08:12:49Z")

</div>

いつも参考にさせていただいております。  
下記のようなExcelで、B列(グループ)の重複を検出し、B列内で重複があればAC列も含めてすべての行を削除したいと考えています。

 ![無題](https://global.discourse-cdn.com/uipath/original/3X/3/7/377473439df8762b934813264c6a97e131be911e.png)  
このような場合、「重複行を削除」というアクティビティではデータテーブルを入力しなければいけないので削除できませんでした。わかりやすい方法ございましたらご教示お願いいたします。

---

<div class="post-metadata">

**Author:** ![pravin\_calvin](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pravin_calvin/32/212149_2.png) [@pravin\_calvin](https://forum.uipath.com/u/pravin_calvin)\
**Post date:** [September 27, 2021, 8:29am UTC](https://forum.uipath.com/t/topic/348564/2 "2021-09-27T08:29:11Z")

</div>

Hi @nara1

Please use the below expression!

> Dt.DefaultView.ToTable(true,“YourColumnnameThatContainsDuplicates”)

Regards

---

<div class="post-metadata">

**Author:** ![nara1](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nara1/32/178184_2.png) [@nara1](https://forum.uipath.com/u/nara1)\
**Post date:** [September 28, 2021, 12:15am UTC](https://forum.uipath.com/t/topic/348564/3 "2021-09-28T00:15:08Z")

</div>

ご返信ありがとうございます。ご指示いただいた通り実践しましたところ、やはり完全一致の行が削除されて、「B列」の重複を検知した場合、すべての行を削除はできませんでした。

 ![無題](https://global.discourse-cdn.com/uipath/original/3X/f/3/f3a4f96e01593e272c6bcbd6bae9948654a533c7.png)  
特定の列に重複があった場合、すべての行を削除する方法があれば教えていただきたいです。

Thank you for your reply. When I practiced as instructed, if the exact match row was deleted and the duplicate of “Column B” was detected, all the rows could not be deleted. I would like to know if there is a way to remove all rows if there are duplicates in a particular column.

---

<div class="post-metadata">

**Author:** ![cheez\_RPA](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/cheez_rpa/32/278069_2.png) [@cheez\_RPA](https://forum.uipath.com/u/cheez_RPA)\
**Post date:** [September 28, 2021, 1:23am UTC](https://forum.uipath.com/t/topic/348564/4 "2021-09-28T01:23:43Z")

</div>

おそらく設定いただく内容が異なります。下記をお試しください。

```auto
Dtsample.DefaultView.ToTable(True, "グループ")

```

---

<div class="post-metadata">

**Author:** ![pravin\_calvin](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pravin_calvin/32/212149_2.png) [@pravin\_calvin](https://forum.uipath.com/u/pravin_calvin)\
**Post date:** [September 28, 2021, 10:00am UTC](https://forum.uipath.com/t/topic/348564/5 "2021-09-28T10:00:06Z")

</div>

Hi @nara1

Please use the below LINQ expression!

> (From p In buildDt.Select() Where( From q In buildDt.Select() Where q(“Column2”).Equals(p(“Column2”)) Select q).ToArray.Count=1 Select p).ToArray.CopyToDataTable()

Refer to the sample xaml below!

[Remove\_Duplicates.xaml](https://forum.uipath.com/uploads/short-url/eJ0Plp4FzSiQD6C9MKktaahZZ76.xaml) (8.5 KB)

Regards

---

<div class="post-metadata">

**Author:** ![nara1](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nara1/32/178184_2.png) [@nara1](https://forum.uipath.com/u/nara1)\
**Post date:** [September 28, 2021, 11:42am UTC](https://forum.uipath.com/t/topic/348564/6 "2021-09-28T11:42:45Z")

</div>

Thank you very much. I got the intended result.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [October 1, 2021, 11:43am UTC](https://forum.uipath.com/t/topic/348564/7 "2021-10-01T11:43:14Z")

</div>

Closed on October 1, 2021, 11:43am UTC

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