Add same number into two rows

Hi Everyone.

I have datatable as attached excel file.

I want to add sequence number into rows as attached picture.

How to do that without loop row in datatable?? Such as Linq

Thanks in advance!
Book1.xlsx (8.3 KB)

Hi,

Do you want to flll it at blank Number column? If so, the following helps you.

img20210611-3

dt.AsEnumerable.Select(Function(r,i) dt.Clone.LoadDataRow({r("item"),Math.Floor(i/2)+1,r("Quantity")},False)).CopyToDataTable

Sample20210611-3.zip (9.8 KB)

Regards,

1 Like

Thanks you very much!

1 Like

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