Data Table Filter - Error - "Data Table Filter: Min (74) must be less than or equal to max (-1) in a Range object."

Hi All,

I am filtering a “Column” in a spreadsheet as
dtCareerSheet.Select(“ZIPCODE=”+strZip.ToString)
I am getting the below error when executing the test. Does anyone had similar problem, resolved it ?Please help.
Error: Data Table Filter: Min (74) must be less than or equal to max (-1) in a Range object.

Many Thanks,
Sanj

Try this
dt.Select(“[ZIPCODE]=‘yourvariable’”).CopyToDataTable


@hasib08, I have it like this. It works normally in test, but for some reason it is failing when running in a specific scenario.

Resolved this issue:
The reason was not the expression passed in to filter the Data table (so, no changes done to the code).
The issue was with the excel data sheet where the rows in the filtered column were having numbers which were not converted to number.
Error on cell value - “The number in this cell is formatted as text or preceded by an apostrophe”
image

Thanks all for extending your support!!!

Hi @skhiremath

U can try this linq query for filtering

dt.AsEnumerable().Where(Function (row) row(“Zip code”).ToString.Equals(strShipperZip)). CopyToDataTable

1 Like