Exception:Assign : Min (114) must be less than or equal to max (-1) in a Range object

Can some one please help with the following error message?

Assign : Min (114) must be less than or equal to max (-1) in a Range object.

It is displayed as ‘Argument Exception’. I encountered this while using dt.select().



Hey @Shatakshi_Mishra

The above problem starts with your select query expression, it looks like a numeric expression to the query parser, not a string.

There is things in the background about index which builds with string so just whatever variable you are using i guess that is of Int32 type just convert that into String by using .ToString() then it should solve your problem.


Hey @aksh1yadav Thanks for replying
I am using assign activity as below,

dte = Exl1.Select(“Dt =’”+stDaEx_3+"’")(0)(“Day”).ToString()

Dt is the column name,
Day is column name.

I am still getting the error. : (

Did you try using Lamda Expression?

Exl1.AsEnumerable.Where(Function(r) r.Field(of string)("Dt")=stDaEx_3)(0)("Day").ToString

Someone else had same issue in the past, not sure if it got resolved.

Hey @vvaidya Thanks for replying!
I tried doing what you have showed but that gives an error:

'Unable to cast object of type ‘System.DateTime’ to ‘System.String’ '.

Same holds true for other data types as well, Unable to convert to string.

Did you try modifying the types(Column & Variable) to DateTime ?

It’s showing the same error for any data type.
Somehow the ToString() is not getting invoked.

Hi @Shatakshi_Mishra, have you ever solve this problem? I met the same situation when using Datatable.Select.
It’s like:
totalTable.Select(“Start Date = '”+row.Item(“A”).ToString+"’ and End Date = ‘"+row.Item(“B”).ToString+"’")

I guess it might caused by one of the column I used to select is date format but I can’t find the solution.

Is there a solution to this?
I’m doing: dtFiltered = dtFacturiRidicata.Select("[Nr. Fiscal Fact] = '"+dtDistinctFacturi.Rows(InvoiceCounter).Item("Nr. Fiscal Fact").ToString+"'").CopyToDataTable and I’m getting: Invoke GetTransactionData workflow: Assign : Min (1464) must be less than or equal to max (-1) in a Range object.

Hey Rynn, have you solved your problem? i’m facing the exact same problem where one of my column is of Date Format.

Throwing my hat into the ring - anyone find a solution?

I have tried with and without single quotes, as well as sorting the table - no dice

I am importing a datatable from excel - I believe the issue is something to do with the format of the data
In my case it errors out on line 113 of the datatable. after successfully working up till then.


I have found two potential solutions -
Add a new column with datatype string - then port the new value over and typecast as you go. You should then be able to use the select statement on the new column with no issues

Two: In the new 18.4 Uipath Studio - select the “Preserve Formatting” checkbox when importing the datatable from Excel

I believe is to do with VB.NET trying to match a string against an int or an object type datavalue

1 Like


This has been working before and now i get same type of error. Yes i do a dt.Select(“Orders” = ‘" +OrderNumber + "’").CopyToDatatable

OrderNumber is type String. Not sure why this stopped working now. Then i did typecast also to OrderNumber so now i get it from row save it assing again StringOrderNumber with OrderNumber.ToString and not working :frowning:

Min (21987) must be less than or equal to max (-1) in a Range object.

Hi, all!
If anyone is still getting this error, it is caused by type mismatch in the Column and the Select expression.
It looks like your column is of type different than String and you have used the “’” to search for string in the Select statement.
Try converting the Column data type in the select statement:
dt1.Select("Convert([Column1], ‘System.String’) = ’ " + sSearchString + " ’ ")


1 Like

Thanks a LOT!!!