+ Reply to Thread
Results 1 to 5 of 5

Concatenate and ignore blanks

  1. #1
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Concatenate and ignore blanks

    Hi I'd like to concatenate the two columns in the file I've attached as a string of text that I can copy to another sheet.

    The second column in the file attached will be a vlookup from another sheet.

    However as shown in the file, I'd like to ignore blank cells and only concatenate if they have data in them.

    Please help! I'm sure it's simple but have been stuck with this!

    Nujwaan.
    Attached Files Attached Files
    Last edited by nujwaan; 09-22-2009 at 04:26 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Concatenate and ignore blanks

    If you have small sets of data as per your example perhaps:

    Please Login or Register  to view this content.
    Called from a cell along lines of:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Concatenate and ignore blanks

    Hi DonkeyOte thanks for that.

    Where would I enter this code? Do i need to assign it to a button or something? and what do you mean by the second bit of code you gave me?

    I'm a newbie to VBA so apologies!

    Nujwaan.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Concatenate and ignore blanks

    The VBA code (UDF) should be placed into a Module in VBE.

    UDF's can be invoked from a cell as per other excel functions (VLOOKUP, SUMIF etc...), so in whichever cell you want the list to appear simply add the appropriate formula:

    =NAMEGRADE(A3:A16,B3:B16,", ")

    where A3:A16 represents your range of Names, B3:B16 the range containing the associated Grades and finally ", " (ie comma followed by space) which represents the delimiter to be used ... ie how you intend to split the various names (grades) from one another in the final list.
    Last edited by DonkeyOte; 09-22-2009 at 04:27 AM. Reason: revised "are generally" to "can be"...

  5. #5
    Registered User
    Join Date
    09-16-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Concatenate and ignore blanks

    THANK YOU!

    Worked Beautifully! I love you man!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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