I currently have the following problem. I have two lists available. In list A, column A contains various material numbers. In another list, these material numbers are also included but with different dates. I would like to find the closest date and then write this row in a new Excel. Do you have any ideas?
Try this syntax in the meanwhile can you please share the sample input:
result = (From rowA In dtListA.AsEnumerable()
Join rowB In dtListB.AsEnumerable()
On rowA("MaterialNumber") Equals rowB("MaterialNumber") Into Group
Let closestDateRow = Group.OrderBy(Function(r) Math.Abs((CDate(r("DateColumnB")) - CDate(rowA("DateColumnA"))).TotalDays)).First()
Select rowA("MaterialNumber"), ClosestDate = closestDateRow("DateColumnB")).CopyToDataTable()
Hi, thanks for your anwser. Here is a picture of my two excel lists.
For each material number, I need all the customers who ordered last. As shown in the picture. I need all customers for the material
here i have an input list and a customer list when each customer always ordered and i need a new list with the data from the input list and when each customer last ordered.