Combing columns in a loop to create a new column

Hi there,

I have a problem, I need to combine a number of columns within a table based on a suffix. The columns have been created from a collection cell that has been split, so has the suffix _1, _2,_3 etc. I need to combine columns with the same suffix together to form a new column and be able to name these new columns as combined_1, combined_2, combined_3 etc.

How can I do this ?

I have loaded an excel file with an example dataset, so the output should be;

combined_1 (contains all elements with suffix _1)
combined_2 (contains all elements with suffix_2)
combined_3 (contains all elements with suffix_3)

Thanks,

Stanage
Book1_ExampleDataSet.xlsx (8.8 KB)

Hi @stanage , and how should the combined data look like? I mean, what’s the “glue” or separator between the combined data?

Hi @stanage , I’ve combined them as a list in the mean time since I don’t know how you want the data to be.

This is how I did it:

Input (your file):

Results:
image

You can convert the list to string easily after that with whatever separator you want to use.

Here’s the workflow: Combine columns based on suffix in name.knwf (33.4 KB)

1 Like

Hi Bruno,

Excellent, thanks for the workflow, this is exactly what I was after, I just couldn’t figure it out. I learn something new again :slight_smile: Many thanks for the quick response.

Stanage