+ Reply to Thread
Results 1 to 7 of 7

Using concatenate that ignores blank cells and also includes line breaks

  1. #1
    Registered User
    Join Date
    06-01-2016
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Using concatenate that ignores blank cells and also includes line breaks

    Good morning!

    I have five columns: Name / Address 1 / Address 2 / Address 3 / Address 4

    I would like to concatenate them into one cell, but with a line break between item, the result being:

    Name
    Address 1
    Address 2
    Address 3
    Address 4

    in the same cell

    I am able to do the above where there is data in all cells but where one of the cells (eg Address 3) is blank it returns the following:

    Name
    Address 1
    Address 2

    Address 4

    Whereas I want it to show:

    Name
    Address 1
    Address 2
    Address 4

    All help gratefully received!

  2. #2
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,935

    Re: Using concatenate that ignores blank cells and also includes line breaks

    Assuming your data in A2,B2,C2,D2 & E2 then

    F2=A2&CHAR(10)&B2&CHAR(10)&C2&CHAR(10)&D2&CHAR(10)&E2

    Then Copy paste F column as paste value only
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  3. #3
    Registered User
    Join Date
    06-01-2016
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Re: Using concatenate that ignores blank cells and also includes line breaks

    Many thanks for the speedy response but that doesn't seem to work I still get the blank space where the blank cell is?

  4. #4
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,935

    Re: Using concatenate that ignores blank cells and also includes line breaks

    Try

    =SUBSTITUTE(A2&CHAR(10)&B2&CHAR(10)&C2&CHAR(10)&D2&CHAR(10)&E2," ","")

  5. #5
    Registered User
    Join Date
    06-01-2016
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Re: Using concatenate that ignores blank cells and also includes line breaks

    Hi, unfortunately that doesn't work as it doesn't ignore the blank cell and also removes the spaces within the address lines (e.g. 1 The Street becomes 1TheStreet) which I don't want.

  6. #6
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Using concatenate that ignores blank cells and also includes line breaks

    This works, but...

    =A2&CHAR(10)&IF(B2="","",B2&CHAR(10))&IF(C2="","",C2&CHAR(10))&IF(D2="","",D2&CHAR(10))&IF(E2="","",E2&CHAR(10))

    ...I can't get it show a line feed for CHAR(10)

    UPDATE: You need to format the cell with Alignment / Wrap Text then it works
    Last edited by Special-K; 06-02-2016 at 04:46 AM.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  7. #7
    Registered User
    Join Date
    06-01-2016
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Re: Using concatenate that ignores blank cells and also includes line breaks

    Thanks - I tweaked it slightly to put a line break between the data in A2 and B2:

    =A2&""&IF(B2="","",B2&CHAR(10))&IF(C2="","",C2&CHAR(10))&IF(D2="","",D2&CHAR(10))&IF(E2="","",E2&CHAR(10))

    Pressing ALT + ENTER between the first set of "" and this has worked.

    Thanks very much for your help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 03-29-2022, 05:35 AM
  2. Address Concatenate and Line Breaks Failing in Word
    By pdavies1 in forum Excel General
    Replies: 2
    Last Post: 09-22-2015, 10:23 PM
  3. Replies: 3
    Last Post: 08-21-2014, 02:54 PM
  4. [SOLVED] Find & Edit Formatting of text in string that includes line breaks
    By Jennasis in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-07-2014, 11:50 AM
  5. Replies: 8
    Last Post: 09-09-2013, 08:46 AM
  6. Replies: 2
    Last Post: 07-11-2012, 08:58 AM
  7. Concatenate and Line Breaks
    By Invoice in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-17-2006, 04:55 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1