# 任意の文字列の場所を取得したい

**URL:** <https://forum.uipath.com/t/topic/317331>\
**Category:** フォーラム\
**Created:** [May 24, 2021, 4:47am UTC](https://forum.uipath.com/t/topic/317331 "2021-05-24T04:47:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![miwa\_yamamoto](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/miwa_yamamoto/32/176649_2.png) [@miwa\_yamamoto](https://forum.uipath.com/u/miwa_yamamoto)\
**Post date:** [May 24, 2021, 4:47am UTC](https://forum.uipath.com/t/topic/317331/1 "2021-05-24T04:47:10Z")

</div>

UiPath初心者です。

データテーブル内で、任意の文字列と一致する場所(行カウント)を取得したいです。  
（その後、その次の行から 任意の行数、データテーブルをコピーし、Excelへ貼付したいので、  
その際使う、元データの位置取得に使いたいです。）

よろしくお願いいたします。

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [May 24, 2021, 4:56am UTC](https://forum.uipath.com/t/topic/317331/2 "2021-05-24T04:56:09Z")

</div>

こんにちは

> データテーブル内で、任意の文字列と一致する場所(行カウント)を取得したいです。

対象は特定の列でしょうか？そうであれば例えば以下になります。

```
dt.AsEnumerable.Select(Function(r,i) if(r("Column1").ToString="Keyword",i,-1)).Where(Function(i) i>=0).First()

```

---

<div class="post-metadata">

**Author:** ![miwa\_yamamoto](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/miwa_yamamoto/32/176649_2.png) [@miwa\_yamamoto](https://forum.uipath.com/u/miwa_yamamoto)\
**Post date:** [May 24, 2021, 5:42am UTC](https://forum.uipath.com/t/topic/317331/3 "2021-05-24T05:42:03Z")

</div>

いつもありがとうございます。

1行少ないカウントになったのですが、1行目＝0となりますでしょうか。

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [May 24, 2021, 5:42am UTC](https://forum.uipath.com/t/topic/317331/4 "2021-05-24T05:42:51Z")

</div>

こんにちは

> [@miwa\_yamamoto](#):
>
> 1行目＝0となりますでしょうか。

DataTableにおけるインデックス番号は0始まりですので、そのようになります。

---

<div class="post-metadata">

**Author:** ![miwa\_yamamoto](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/miwa_yamamoto/32/176649_2.png) [@miwa\_yamamoto](https://forum.uipath.com/u/miwa_yamamoto)\
**Post date:** [May 24, 2021, 5:43am UTC](https://forum.uipath.com/t/topic/317331/5 "2021-05-24T05:43:15Z")

</div>

ありがとうございます！  
変数を使っても無事に数値を取り出せました！

---

<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:** [May 27, 2021, 5:43am UTC](https://forum.uipath.com/t/topic/317331/6 "2021-05-27T05:43:59Z")

</div>

Closed on May 27, 2021, 5:43am UTC

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