Select query to look up item in Excel


I am trying to find the following item in a data table I have but it keeps giving me back the first row of the data table instead of the row where the value is. Can anyone tell me where I am going wrong? Invoice Number is a column name in the data table and 505 will be replaced with a variable. I am also using this in an if condition to first check if that invoice number exists in the data table

I don’t want to lop through each row as it takes to long

invoiceDT.Select("[Invoice Number]=’"+("[505]").ToString+"’").Count > 0


did you check the “Invoice number” column data type? If it is numeric you shouldn’t add the single quote mark.

Or also something in syntax is not right, like the square brackets into “[505]” doesn’t seem right (because within square brackets is the column name).

If it can help, this link explains really good how to use the “Select” method:
DataView RowFilter Syntax [C#] (


Hi @Bob2,

Assign 505 to VarX and try below query.

invoiceDT.Select("[Invoice Number]=’"+VarX+"’").Count > 0



You could also use Filter data table activity…