Check if a value exists in particular column

Hi, how to check if a string value is available in one column of data table.
Example , i want to search “uipath” is available in my my datatable named, dt1 in column “Name”
The column in which i want to search has comma and space separated values like

uipath, automationanwhere, blueprism

I want to search in the column “Name” of above dt1 table that my variable “uipath” is available or not

1 Like


Check below
Tutorial : How to check a string is present in Excel Sheet || Part - 1

Follow Link

Hope this helps you


hi @Srini84 , you are using for each row and checking like row(“Name”).ToString = StrVariable
But buddy i dont want to use for each row because my variable is already coming from for each row which i want to match in another datatable.

I tried this query

DT1.AsEnumerable.Select(function® r(“Name”).ToString.Contains(“+StrVariable+”)).Contains(true)
But this doesnt work in this scenario as the coumns in my DT1 has comma separated values

I want the bot to search whether the StrVariable (a string variable) is available in my specific column or not


I have the next video with LinQ query to check if the string is present

Also you don’t need “+StrVariable+” instead you can give StrVariable in brackets, As it is a variable

Hope this helps you


yeah actually, that StrVariable is a variable coming from another activity therefore i was calling like this :smiley:
The thing is with Linq query i cannot search and match if the datatable has comma separated values
otherwise its working fine

See this , i want to search in this column whether “uipath” is available or not
Any idea?

to check if uipath string is present in any row within the long string we can do:

YourDataTableVar.AsEnumerable.Any(Function ( r ) r(“Name”).toString.toUpper.Contains(“UIPATH”))
it will return true or false

retrieving all rows where UiPath is contained in the name column we would use filter datatable along with the condition “Contains”



Check as below

Hope this helps you


@ksrinu070184 @ppr
I believe it will also give True if the DT1 has row(“Name”) like

because it is checking if my that column and in DT1 contains “uipath”
Thanks but this code is not reliable


As per your mentioned it will search for a particular column

and it will search for even if it is uipath1 as you used Contains

If you don’t want then and match the exact then use .Equals instead of .Contains
you have to check as below
Check value exists in Excel Sheet using UiPath (Part-3) | Without using ForEach Loop/FilterDatatable - YouTube

It will match if it found exact match

Hope this helps you


then we can use following:
dtData.AsEnumerable.Any(Function ( r )r(“Name”).toString.Split({“,”}, StringSplitOptions.RemoveEmptyEntries).Contains(“uipath”))

and do use the contains from array checking for uipath as a contained item within the array
Filter Data Table.xaml (6.3 KB)

1 Like

@Srini84 sorry buddy, that doesnt work as already mentioned i have comma separated values in my column in dt1. The above query matches only with one value.

@ppr Thanks buddy, I do not understand your last line
But the query is working fine :slight_smile:
I will test with few sample and mark the solution later
Thanks again

in general it splits the string into a string array, split char is the comma
from the array the contains method looks if a particular string is an item within the array or not


This code is case sensitive, can you help me making this more reliable.

have a look here:

Thank you, can you please explain this to me, so that i can properly use this.
I didnt understand “StringComparison.InvariantCultureIgnoreCase” !!

it is a by .dot Net defined Comparer that is (said in short) implementing a case insensitive comparing

The dtData datatable has values like this
“UiPath: abc: Location; Model: Serial;
automationanywhere: bac: Location; Model: Serial;”

The code is not working in this scenario

please share with us the datatable content from debug view. thanks

I want to search in this data table , in column “Data” that

  1. “mobile” is available or not
  2. “walmart, amazon” is available or not any one of it matches
  3. “Homepage, Accountpage” is available or not ( true if any one match , in else required which is left)