Please support - Do a vlookup using LINQ and assign the value to the specified column

Dear Peter,

Good Day.

I am absolutely sorry to contact in private please excuse me.

I corrected my previous mistake as mentioned by you. I tried to play around with the LINQ previously sent by you with those parameters of skip and take, however I an getting the error as “Assign Profit Center: Input array is longer than the number of columns in this table”

ZreturnDT

INVOICE NO Profit Centre NETAMT .
90071230 51601-058 19.80
90071231 51601-058 8.38
90071232 51601-058 8.76
90071233 51601-058 2.24
91294051 51601-025 339,971.40
91294052 51601-025 300,064.50
91294053 51601-073 1,487,700.00
91294054 51601-025 339,971.40
91294055 51601-037 862,365.60
91294056 51601-037 670,771.20
91294057 51601-037 612,153.60
91294058 51601-037 2,583,878.40

dtResult1

Reference Bank Invoice Bank Amount Sales Amount Difference Net Amount TDS Difference2 Profit Center Comments Comments1 Reason Code
4900067828 8203000073 -201780
4900067827 8203000072 -1069080
4700334343 2100003040 -2361.6
4700334342 2100003039 -2361.6
4700334341 2100003038 -2361.6
4700332997 2100002952 -26981.86
4700305131 97139650 236736.76 236921.86 185095.2
4700305052 97139652 69860 69914.62 54620.8
4700305007 97139651 80930 80993.28 63276
4700305002 97139648 157232.59 157355.52 122934
4700304999 97139649 11295.86 11304.69 8831.79
4700304953 97139527 270321.57 270532.92 211353.84
4700304713 97139643 160850.12 160975.88 125762.4

I need the profit centre from ZreturnDT into Profit Center of dtResult2

(From a In dtResult1.AsEnumerable()
Group Join b In ZreturnDT.AsEnumerable()
On a(“Bank Invoice”) Equals b(“INVOICE NO”) Into gj = Group
From g In gj.DefaultIfEmpty
Let slsa = If(isNothing(g), Nothing, g(1))
Let rapre = a.ItemArray.Take(8).Append(slsa)
Let rapost = a.ItemArray.Skip(7)
Let ra = rapre.Concat(rapost).toArray
Select r=dtResult2.Rows.add(ra)).CopyToDataTable()

I tried to change these parameters, however I failed to understand where I am going wrong.

Appreciate your valuable support.

Regards,
Manjesh

Hello,
Here I have multiple ways how to do VLOOKUP (including multiple files):

Thanks,
Cristian