Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to add new line break to a cell formula in Excel

I have MS Excel looks like this.

A            B          C
---------------------------------
Name         Age        Gender
---------------------------------
Tom Hanks    67         Male
---------------------------------
Jennifer Ann 58         Female
---------------------------------
Mark T       53         Male

I want to create a formula in column D

that gives me the result in this format.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

D
---------------------------------
Info
---------------------------------
Tom Hanks
67
Male
---------------------------------
Jennifer Ann
58
Female
---------------------------------
Mark T
53
Male

I tried this formula but did not work

=A2 & "\n\r" & B2  & "\n\r" & C2

but what I got was

Tom Hanks\n\r67\n\rMale

how to do that?

>Solution :

You may use any one of the following depending on your excel version:

enter image description here


• Formula used in cell D2 –> works with Excel 2019+ onwards.

=TEXTJOIN(CHAR(10),,A2:C2)

Or,

• Formula used in cell E2 –> believe it works across all versions

=A2&CHAR(10)&B2&CHAR(10)&C2

Or,

• Formula used in cell F2 –> Works with MS365 only

=MAP(A2:A4,B2:B4,C2:C4,LAMBDA(x,y,z,TEXTJOIN(CHAR(10),,x,y,z)))

Note: In all the above formulas you need to hit the wrap feature available under Home Ribbon in Alignment Group.


Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading