Hi Team, I have an excel which contains duplicate invoice numbers but is sorted in ascending order, so i need to capture the starting index and ending index with respect to the invoice number. The input will be:
and the output will be like: and so on.
@Yoichi Please help.
Hi,
How about the following?
dtResult = dt.AsEnumerable.Select(Function(r,i) Tuple.Create(r,i+1)).GroupBy(Function(t) t.Item1.Item("InvoiceNo.").ToString).Select(Function(g) dtResult.LoadDataRow({g.Key,g.Min(Function(t) t.Item2),g.Max(Function(t) t.Item2)},False)).CopyToDataTable
Sample20230713-2aL.zip (7.8 KB)
Thanks @Yoichi This helped me a lot.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.