How can I determine if a Excel column contains a specific value?

Hi,
I try to determine if a column in an Excel table contains a specific value.

So far I read the column with “Read Column” which gives me an IEnumerable.
Then I iterate through the IEnumerable and compare each value with the value searched.

This works, but seems a bit slow to me. So I look for a faster and easier to implement way.

Contents of the column can be Integers or Strings, depending on the situation I use it.

I tried IEnumerable.Contains(SearchValue) but always got False as result. Maybe because I provided the search content in a wrong form.

grafik

Any ideas?

Regards
Oliver

Hi @OKlink ,

Try lookuprange activity.

Hi @OKlink

Please use the LINQ function below.

yourDT.AsEnumerable().Any(Function(x) x("Column1").ToString = DesiredValue)

Regards

Hi Pravin,

thank you very much. This solutions works perfectly for me.

I implemented it like this directly in an If-Activity (Excel is my IEnumerable):
Excel.Any(Function(x) x.ToString.Equals(SearchValue.ToString))

Regards
Oliver

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