+ Reply to Thread
Results 1 to 7 of 7

Combine multiple cells text into one cell, skip blank cells.

  1. #1
    Registered User
    Join Date
    07-10-2012
    Location
    NSW, Australia
    MS-Off Ver
    Excel 2010
    Posts
    76

    Combine multiple cells text into one cell, skip blank cells.

    Hello,
    I need help with a formula to join multiple text from different columns into one.
    For example, combine text in A1, B1, C1, and D1 into a cell E1. I would like each cell to be separated by a comma
    so far in E1 I have A1&","&B1&","C1&","&D1

    The complication is that sometimes A to D might be blank, and if that is the case I dont want that blank to be copied across. At present I would end up with a double comma in the cases where there is no data in any cell.

    Can anyone help me with this problem?

    Thanks in advance
    T15K

  2. #2
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Combine multiple cells text into one cell, skip blank cells.

    Please Login or Register  to view this content.

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Combine multiple cells text into one cell, skip blank cells.

    if the cells have text without spaces in each cell then

    =SUBSTITUTE(TRIM(A1&" "&B1&" "&C1&" "&D1)," ",",")
    if the cells contain more than one word each then
    =SUBSTITUTE(SUBSTITUTE(TRIM(SUBSTITUTE(A1," ","^")&" "&SUBSTITUTE(B1," ","^")&" "&SUBSTITUTE(C1," ","^")&" "&SUBSTITUTE(D1," ","^"))," ",","),"^"," ")
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Registered User
    Join Date
    07-10-2012
    Location
    NSW, Australia
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: Combine multiple cells text into one cell, skip blank cells.

    Both great solutions, thank you very much.

  5. #5
    Registered User
    Join Date
    12-05-2014
    Location
    Riyadh, Saudi Arabia
    MS-Off Ver
    2019
    Posts
    1

    Re: Combine multiple cells text into one cell, skip blank cells.

    Hello everyone,
    Does anybody have an idea what to do if we have a large number of cells (80 or 90)? Is there any VBA solution for that?

    Thanks

  6. #6
    Registered User
    Join Date
    12-15-2009
    Location
    USA
    MS-Off Ver
    2003,2007,2010,2013
    Posts
    28

    Re: Combine multiple cells text into one cell, skip blank cells.

    Please Login or Register  to view this content.

  7. #7
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Combine multiple cells text into one cell, skip blank cells.

    mfaheem1234,
    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Ben Van Johnson

+ 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. [SOLVED] How to make Excel VBA to skip blank cells until a cell has a number
    By vnzerem in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-11-2013, 08:29 PM
  2. [SOLVED] Copy text from multiple cells and combine to one cell
    By villman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2012, 12:01 AM
  3. Combine text in multiple cells if adjacent column is blank
    By problematic in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-10-2012, 01:52 PM
  4. Replies: 2
    Last Post: 12-03-2011, 03:51 AM
  5. Replies: 3
    Last Post: 04-27-2011, 12:59 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