Add multiple lines of data based on logic in one field

I have a setup like this in a spreadsheet/csv file (input):

Third column here, is a number. This now means the number of pieces of an article. I need to reformat this to the articles length in mm times the number of articles, and add a set of rows equal to the number of pieces plus whatever is left if the number does not have decimals.

Eg, let us say the article length is 3000mm. If the number in col3 is 5,2, I need to have 5 rows with a length column=3000, and a sixth row with length column=600 (3000*0,2).

Is there an easy way to go about doing this with EDT? I guess the answer is YES, but I have not figured out how yet… :slight_smile:

Can you show the output you want for the example above? Maybe just for the first 2 or 3 rows.

Sure thing:

So with just two of the rows from above, simplified even more wrt number of columns, this is how I want the results:

Stock No Length Physical Stock
26 3000 5,2
26 3000
26 3000
26 3000
26 3000
26 3000
26 600
36 4000 9,1
36 4000
36 4000
36 4000
36 4000
36 4000
36 4000
36 4000
36 4000
36 4000
36 400

It is possible. But I wouldn’t call it easy!

image

egilDOTnet.transform (9.7 KB)

I’m sure there is a more elegant approach.

1 Like

Thanks, that put me in the right direction - I was able to get it sorted, with 34 items in all (for doing various other calcs etc). I did some tweaking to get the correct number of “whole” lines, above there is 1 to many :slight_smile:

Thanks for helping me out!

I probably referenced the wrong column somewhere.

Hi,

I looked into the transformation, quite impressive exercise.

I used copy row early so far and then only in the simple default way. The transformation for here shows the different options possible in a useful manner.
Similar for me with the slide application, I never used before, to use slide just for given columns.

During the analysis I found the referenced wrong columns, which was even not necessary to calculate and I combined the two if statements into one.

Learned some good functionality with the review :hugs:

Here the small change possibilities I recognized in the bottom row

egilDOTnet 2.transform (17.1 KB)

1 Like

In my defense, I was in a hurry. ;0)

it happens, if you start with try and error, that you forget to remove some stuff later on :wink:

1 Like