How to check value contains in Excel file till last entry


I am trying to check the value contains in Excel file or not using For Each. but it check one by one row and if not contains in 1st row directly goes to Else part without checking till last entry and shows not value.
Can anyone please suggest how to overcome this.

Attached it the Sample file & demo solution.
Demo (327.3 KB)


Please find the updated work flow. you have to use Row(“City Description”).ToString instead of row(0).tostring. for working in my machine i have changed the input excel path. please change accordingly to your machine. thanks

Demo (24.3 KB)

we would recommend that you do a reprhrasing of your requirement. A quxi review on your code did let open to much open questions

Hello Peter,
I want to check whether any specific text contains in A Column or not as per Input file. If contains then take value from same row from C Column.
Ex. text contains in A4 then get the value from C4.
My requiremnt is if that text is not availeble in entire A column then only go into Else part.

Demo (327.3 KB)

here we do see some unsharp requirement
maybe following helps:

checking row level we can do within a for each / if combination
checking on all rows to return a boolean if any datarow’s column XX has Value YY, we can do

Assign activity:
hasValue =

yourDTVar.AsEnumerable.Any(Function (x) x(ColNameOrIndex).toString.Trim.Equals(strKeyWord))