Which column u are lookuping here ?
I have to update this table, this table have also lakhs of record, and in this , stock level and buynowprice needs to update if sku will match in both the files.
Then use this code in invoke code
argument —>
dt1 ---- In/Out
dt2 ----- In/Out
dt1.AsEnumerable().ToList().ForEach(Sub(row) row(“price”)= if(dt2.AsEnumerable().Where(Function(r) r(“sku”).ToString.Trim.Equals(row(“sku”).ToString.Trim).Count<>0, dt2.AsEnumerable().Where(Function(r) r(“sku”).ToString.Trim.Equals(row("sku”).ToString.Trim)(0)(“price”).ToString,row(“price”).ToString))
dt1.AsEnumerable().ToList().ForEach(Sub(row) row(“quantity”)= if(dt2.AsEnumerable().Where(Function(r) r(“sku”).ToString.Trim.Equals(row(“sku”).ToString.Trim).Count<>0, dt2.AsEnumerable().Where(Function(r) r(“sku”).ToString.Trim.Equals(row("sku”).ToString.Trim)(0)(“price”).ToString,row(“quantity”).ToString))
Regards,
Nived N
getting error. Can you please append this part on my soln.I never used Invoke code.
Please help.
Can you share the xaml ??
Will correct and send it back
Hi, please check my my xaml file soln once ,pleas help
Yes, please I shared the xaml file, please help
Hi @Anjali_Rani
How about invoke VBA?
Execution time only 3~4mins.
Here is my solution.
Forum1215.zip (8.6 MB)
Sub TEST()
Dim RowsCountSheet1 As String
Dim RowsCountData As String
RowsCountSheet1 = Sheets("Sheet1").UsedRange.Rows.Count
RowsCountData = Sheets("Data").UsedRange.Rows.Count
Range("AC2").Select
ActiveCell.FormulaR1C1 = _
"=IFNA(VLOOKUP(RC[-27],Sheet1!R1C1:R" & RowsCountSheet1 & "C4,2,FALSE),RC[-26])"
Range("AD2").Select
ActiveCell.FormulaR1C1 = _
"=IFNA(VLOOKUP(RC[-28],Sheet1!R1C1:R" & RowsCountSheet1 & "C4,3,FALSE),RC[-26])"
Range("AC2:AD2").Select
Selection.AutoFill Destination:=Range("AC2:AD" & RowsCountData & "")
Range("AC2:AD" & RowsCountData & "").Select
Selection.Copy
Range("C2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("D3").Select
Columns("AC:AD").Select
Selection.Delete Shift:=xlToLeft
End Sub
- Open a blank workbook on MS Excel
- Got to File >> Options
- Click on Trust Center >> Trust Center Settings
- Click on Macro Settings >> Check ‘Trust Access to the VBA project object model’ (under Developer Macro Settings)
- Restart your Excel.
Hi can you please help me to understand this code? Please can you explain little bit
@Anjali_Rani
Does this workflow work fine?
This code meaning is:
- Copy dt2 to dt1 in order to Vlookup
- Call VBA to vlookup , search the new price and quantity in dt2(Sheet1)
and show them in Column AC and AD. - If there is no new price and quantity, it will show NA. Then IFNA will show the original price and quantity.
- Copy the Column AC:AD to D:E to replace the old price and quantity.
Yes, working Thank you so much!! Thanks a ton.
Hi, while comparing with smaller data, i am getting extra 0;s and other data can you check this once please!!
Thank you so much.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.