セルの値が空なら同じ行のある値を持ってくる

こんにちは。
下の表のように、有無の列に値が入っていなければ該当者の名前を取得できるようにしたいです。
表だとヤマモト・マツモト・オオバの有無の列が空なので、メッセージボックスに三名の名前が出るようにしたいです。
B列が空ならA列の値を取得?と考えたのですが、まったくできません…。
よろしくお願いいたします。

スクリーンショット (167)

いろんな方法がありますが

単純でわかりやすい方法なら
excelファイルを開いて
2から6までループ(nをカウンタとする)
Bnセルを取得
空ならAnセルを取得して表示用変数に追加
ループに戻る
表示用変数をメッセージボックスに出力

とかの感じでできると思いますが、何がわからないでしょうか・・・

#これもデータテーブルに読んでLINQでselectするのが簡単ですね

1 Like

Hi @sayaka.y

  1. Use the “Read Range” activity to read the Excel table into a DataTable variable.
  2. Use a “For Each Row” activity to iterate through each row in the DataTable.
  3. Add an “If” activity to check if the value in the presence column is empty. You can use the condition String.IsNullOrEmpty(CurrentRow(“Presence”).ToString()).
  4. If the condition is true (meaning the presence column is empty), you can use a message box activity to display the value of the name column. For example, you can use CurrentRow(“Name”).ToString() in the message box.

Hope it helps!!

1 Like

こんにちは

たとえば以下データテーブルをフィルターアクティビティを使った例です。
いかがでしょうか?

Sample20230707-1.zip (7.5 KB)

1 Like

やり方がまったく思い浮かびませんでした…

ありがとうございました!無事にできました!

1 Like

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