The same value in specific Excel Column

Hello,

I need to check if I have more than 1 the same Material Code in the column Material Code. If I have more I want to assign False to var_arg_out_MaterialUnique
My input file

I was trying to use below solution

However each time I run a process I have an error:
If: Syntax error: Missing operand after ‘Code’ operator.

Maybe you know other solution

@niteckam
give a try on surrounding the column name with [yourColName]

Then I have
If: Cannot perform ‘=’ operation on System.Double and System.String.

please share the validation isse screenshot. thanks

is there any reason that you are using the the first column for compair. As far I understood you want to compair Material code with Material code - Col(1) With Col(1)

as an alternate give a try on LINQ
yourDatatableVar.AsEnumerable.Where(Function ( r ) r(“Material Code”).toString.Trim.equals(row(“Material Code”).toString.Trim)).Count > 1

Yes I have to compare vale form column Material Code as in other columns I may have not in fact the same value in corresponding rows

yourDatatableVar.AsEnumerable(Where Function ® r(“Material Code”).toString.Trim.equals(row(“Material Code”).toString.Trim)).Count > 1 I do not get part Function ® r Should I use @ ?

material code is a number, just remove the ’ you have around it…

Still the same error when I removed ’

was a editor replacement formatting issue:

yourDatatableVar.AsEnumerable.Where(Function ( r ) r(“Material Code”).toString.Trim.equals(row(“Material Code”).toString.Trim)).Count > 1

sorry was a typo, phone was ringing

yourDatatableVar.AsEnumerable.Where(Function ( r ) r(“Material Code”).toString.Trim.equals(row(“Material Code”).toString.Trim)).Count > 1

1 Like

That is not the same error… now you have a syntax problem, with extra " after your .ToString

I dont understand what you tried to say there, but nevertheless, i only replied to him as he was talking to me…

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