I want to put an Excel value according to the quantity into a cell

I want to put the value of column L into column K according to the quantity. What should I do?
(For example: i2 column is l2 column, i7 column is L7,8 (delimiter is “,”).

You can also make it with XAML. I will upload a test sample.TESTSAMPLE.xlsx (10.9 KB)

Hy @111398,

I did not quite understand what you want to do.
Could you please explain it again?

Thanks

@111398

Try this piece of code: ExcelGrunt.zip (25.0 KB)
Basically, the approach you should follow here goes like this:

  1. Load column L values into a separate table to have an iterable list.
  2. Load the worksheet in a different datatable.
  3. For Each Row in Datatable, read values and get ‘Quantity’
  4. Run an internal while loop for the value of Quantity, get next value from Column L datatable.

I have built a skeleton for this logic. A snapshot below:

TESTSAMPLE.xlsx (11.2 KB) 코스트코_접수_2020-06-24.xlsx (11.2 KB)

TESTSAMPLE.XLSX is the result I want and the other is an existing file.

TESTSAMPLE.xlsx (11.2 KB) 코스트코_접수_2020-06-24.xlsx (11.2 KB)

TESTSAMPLE.XLSX is the result I want and the other is an existing file.
What’s inside WHILE?

I didn’t complete that logic. I just built a structure to get you started.
In the while loop, you just need to implement a logic to assign the value in L column to a temporary variable.

listColumnL.Rows(intCounter)(0).ToString

If temp variable already has a value, then append a comma (this means there are multiple tracking numbers). That should get you the results.

This thread is a duplicate of I want to put Cell an Excel value into a cell based on quantity.
The final solution is available on the linked post.

Duplicate of I want to put an Excel value according to the quantity into a cell