+ Reply to Thread
Results 1 to 6 of 6

How to concatenate text cells but skip blank cells

  1. #1
    Registered User
    Join Date
    03-14-2014
    Location
    Mordor
    MS-Off Ver
    Excel 365
    Posts
    78

    How to concatenate text cells but skip blank cells

    Hello,

    On my sample spreadsheet, I would like to concatenate A1:A15 into a single cell (into say cell B1), separating each cell by a comma and space, and skip all blank cells. These cells will actually be formulas, so that’s why I will sometimes have blank cells that can’t be removed beforehand. Also, no long nested IF’s, because I will expanding the column to over 50 rows. The final solution should generate:

    Lions, Blue Whales, Bottle-nose Dolphins, Tiger, Sloth, Gremlin, Red Wolf, Bald Eagle

    So, I also need to skip the last comma and space as well. I’ve tried using Substitute, but it wants to put commas between every single word. I would prefer a non-VBA solution. Thanks!!!
    Attached Files Attached Files

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: How to concatenate text cells but skip blank cells

    Hi jontherev,

    For this you will need a UDF

    and use this formula

    =Concat_Range(A1:A15,", ")

    Corrected: Different code by shrivallabha /Chandoo.org




    Please Login or Register  to view this content.

    1. Copy code below
    2. Press Alt and F11 on your keyboard to open VB Editor
    3. Click on Insert and select Module
    4. Paste code into Module and close VB Editor.
    Last edited by AlKey; 03-25-2014 at 09:33 AM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How to concatenate text cells but skip blank cells

    This isn't elegant but for a limited amount of data it will work. I populated A1:A15 with formulae that drew data from other cells some of which were blank for testing.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by newdoverman; 03-25-2014 at 09:59 AM.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  4. #4
    Registered User
    Join Date
    03-14-2014
    Location
    Mordor
    MS-Off Ver
    Excel 365
    Posts
    78

    Re: How to concatenate text cells but skip blank cells

    Thanks Alkey especially. That was so easy and works perfectly!!! So much for a macro-free workbook, this is just too slick NOT to use. Thanks to newdoverman too, but since I sometimes have as many as 50 rows, that's just too cumbersome.

  5. #5
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: How to concatenate text cells but skip blank cells

    You're welcome and thank you for the feedback!

  6. #6
    Registered User
    Join Date
    03-14-2014
    Location
    Mordor
    MS-Off Ver
    Excel 365
    Posts
    78

    Re: How to concatenate text cells but skip blank cells

    Is there a way to modify the macro below that Alkey supplied to also alphabetize the list? I'd rather do that than making additional columns that are already alphabetized. Thanks!!!

    Please Login or Register  to view this content.

+ 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] Combine multiple cells text into one cell, skip blank cells.
    By T15K in forum Excel General
    Replies: 6
    Last Post: 12-05-2014, 09:49 PM
  2. Replies: 4
    Last Post: 03-08-2014, 02:03 PM
  3. Looking to create a macro that will skip blank cells in a column, find data cells
    By crayzwalz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2013, 09:01 AM
  4. How to Group Cells/Data together? skip UP blank cells
    By KEbrahim in forum Excel General
    Replies: 2
    Last Post: 08-15-2008, 11:27 AM
  5. [SOLVED] How do I skip blank cells when copying over a range of cells?
    By tawells in forum Excel General
    Replies: 2
    Last Post: 06-08-2005, 11:05 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