Columns data into one cell on separate rows

ridug

New Member
Joined
Mar 16, 2023
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have a sheet containing a series of different columns with varying data, and I'm trying to figure out a way to automate pulling those columns' data into a line-by-line separated list in a single cell. The "list" format wouldn't change in column A.

Example data:
1690079216563.png


Is there a way to do this or an alternative method that I'm perhaps overlooking? Any input would be greatly appreciated! Would love to have a semi-automated method at the very least, aha ;)
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi all,

I have a sheet containing a series of different columns with varying data, and I'm trying to figure out a way to automate pulling those columns' data into a line-by-line separated list in a single cell. The "list" format wouldn't change in column A.

Example data:
View attachment 95776

Is there a way to do this or an alternative method that I'm perhaps overlooking? Any input would be greatly appreciated! Would love to have a semi-automated method at the very least, aha ;)
Oops - pretend that "Current URL" and "New URL" say "Page2" and "Page-2"
 
Upvote 0
How about
Excel Formula:
=TEXTAFTER(TEXTSPLIT(A2,CHAR(10)),"-",1)
 
Upvote 0
Could be wrong, but I am interpreting it the other way around. :unsure:
I'm trying to figure out a way to automate pulling those columns' data into a line-by-line separated list in a single cell.

23 07 23.xlsm
ABCDE
1Hdr 1Hdr 2Hdr 3Hdr 4Hdr 5
2Hdr 2 - Data 1 Hdr 3 - Data 3 Hdr 4 - Data 5 Hdr 5 - Data 7Data 1Data 3Data 5Data 7
3Hdr 2 - Data 2 Hdr 3 - Data 4 Hdr 4 - Data 6 Hdr 5 - Data 8Data 2Data 4Data 6Data 8
To single cell
Cell Formulas
RangeFormula
A2:A3A2=LET(a,B$1:E2,SUBSTITUTE(TEXTJOIN({" - ","#"},,TOCOL(CHOOSEROWS(a,1,ROWS(a)),,1)),"#",CHAR(10)))


For the future, I suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with.
 
Upvote 1
Oops, pretty sure you're right then. Guess I was misled by the mention of
The "list" format wouldn't change in column A.
So I believed that was the source rather than the output.
 
Upvote 0
Using the formula @Peter_SSs posted in Message #4 as a basis, this single formula will spill the entire result from this single formula placed in cell A2 (edit the 3 in the E3 at the beginning of the formula to match the last row number in your actual data set)...
Excel Formula:
=BYROW(B2:E3,LAMBDA(r,SUBSTITUTE(TEXTJOIN({" - ","#"},,TOCOL(VSTACK(B1:E1,r),,1)),"#",CHAR(10))))
 
Upvote 1
Depending on whether you wanted to copy down or have a single formula spill down, these would be other options.

23 07 23.xlsm
ABCDE
1Hdr 1Hdr 2Hdr 3Hdr 4Hdr 5
2Hdr 2 - Data 1 Hdr 3 - Data 3 Hdr 4 - Data 5 Hdr 5 - Data 7Data 1Data 3Data 5Data 7
3Hdr 2 - Data 2 Hdr 3 - Data 4 Hdr 4 - Data 6 Hdr 5 - Data 8Data 2Data 4Data 6Data 8
To single cell (2)
Cell Formulas
RangeFormula
A2:A3A2=TEXTJOIN(CHAR(10),,B$1:E$1&" - "&B2:E2)


23 07 23.xlsm
ABCDE
1Hdr 1Hdr 2Hdr 3Hdr 4Hdr 5
2Hdr 2 - Data 1 Hdr 3 - Data 3 Hdr 4 - Data 5 Hdr 5 - Data 7Data 1Data 3Data 5Data 7
3Hdr 2 - Data 2 Hdr 3 - Data 4 Hdr 4 - Data 6 Hdr 5 - Data 8Data 2Data 4Data 6Data 8
To single cell (3)
Cell Formulas
RangeFormula
A2:A3A2=BYROW(B2:E3,LAMBDA(r,TEXTJOIN(CHAR(10),,B1:E1&" - "&r)))
Dynamic array formulas.
 
Upvote 1
Solution
With Power Query aka Get and Transform Data found on the Data Tab of the Ribbon. Bring the data into the PQ Editor. Highlight the first column, click on Transform-->Unpivot--Unpivot other columns.
 
Upvote 1
Depending on whether you wanted to copy down or have a single formula spill down, these would be other options.

23 07 23.xlsm
ABCDE
1Hdr 1Hdr 2Hdr 3Hdr 4Hdr 5
2Hdr 2 - Data 1 Hdr 3 - Data 3 Hdr 4 - Data 5 Hdr 5 - Data 7Data 1Data 3Data 5Data 7
3Hdr 2 - Data 2 Hdr 3 - Data 4 Hdr 4 - Data 6 Hdr 5 - Data 8Data 2Data 4Data 6Data 8
To single cell (2)
Cell Formulas
RangeFormula
A2:A3A2=TEXTJOIN(CHAR(10),,B$1:E$1&" - "&B2:E2)


23 07 23.xlsm
ABCDE
1Hdr 1Hdr 2Hdr 3Hdr 4Hdr 5
2Hdr 2 - Data 1 Hdr 3 - Data 3 Hdr 4 - Data 5 Hdr 5 - Data 7Data 1Data 3Data 5Data 7
3Hdr 2 - Data 2 Hdr 3 - Data 4 Hdr 4 - Data 6 Hdr 5 - Data 8Data 2Data 4Data 6Data 8
To single cell (3)
Cell Formulas
RangeFormula
A2:A3A2=BYROW(B2:E3,LAMBDA(r,TEXTJOIN(CHAR(10),,B1:E1&" - "&r)))
Dynamic array formulas.
Thank you so much! Works a treat! I'll make sure to include an XL2BB-based example next time.
 
Upvote 0

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top