DEV Community

Cover image for Expand Multi-Row Text in A Cell to Multiple Cells
Judith-Excel-Sharing
Judith-Excel-Sharing

Posted on

Expand Multi-Row Text in A Cell to Multiple Cells

Problem description & analysis:

In the following table, column A is the category, and column B includes one or multiple lines of text where the line break is the separator.

original table

The task is to expand each multi-line cell under column B into multiple cells and copy the column A value.

desired table

Solution:

Use SPL XLL to do this:

=spl("=?.news@q(~2.import@si();[get(1)(1),~])",A2:B4)
Enter fullscreen mode Exit fullscreen mode

As shown in the picture below:

result table with code entered
Explanation:

news@q function generates a new sequence by computing members of an existing sequence; ~2 is the 2ndmember of the current variable; import@si parses a string into a sequence of single-line strings according to the carriage return; get() function returns the loop variable according to the layer number during a multilayer loop.

Top comments (2)

Collapse
 
judith677 profile image
Judith-Excel-Sharing

Please feel free to explore more functions of SPL XLL with the following references:
🌐SPL download address: scudata.com/download-Desktop
🌐Plugin Installation Method: c.scudata.com/article/1652061135502
🌐References to other rich Excel operation cases: c.raqsoft.com/article/1651916536524
🌐SPL Programming (YouTube FREE courses): youtube.com/playlist?list=PLQeR-Ih...

Some comments may only be visible to logged-in visitors. Sign in to view all comments.