+ Reply to Thread
Results 1 to 5 of 5

Concatenate variable # of columns

  1. #1
    Registered User
    Join Date
    11-12-2015
    Location
    Boston, MA
    MS-Off Ver
    2013
    Posts
    5

    Concatenate variable # of columns

    I'm not sure if this a question for the Formulas & Functions forum or VBA/Macros forum - please point me in the right direction if you think this can't be solved with a formula/function?

    I'm working to transform formal person names into marginally less formal names (essentially just dropping the Prefix). For various reasons, I can't have our data team export the info without the salutation, so I have to do that through Excel. The problem is that the "full name" form varies across individuals - for example, one person might be Mr. John T. Smith, III and another person might be Ms. Susan Jones. So when I use text-to-columns, I end up with anywhere from 3 to 6 columns of various name 'parts'. Any one column might contain first, middle, or last name info.

    I was hoping I could devise a concatenate function that will auto concat along a row until it reaches a blank cell, which I could copy down the range of rows (so B2 + C2 for Susan Jones, but B2 + C2 + D2 + E2 for John T. Smith, III)

    Does anyone have any ideas on how I might be able to set this up in Excel? Or does it just require a lot of 'manual' concatenating on my part?

    Thank you!

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Concatenate variable # of columns

    There's a really good VBA concatall function here:

    https://www.excelforum.com/showthread.php?p=3096647
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Contributor
    Join Date
    05-04-2014
    Location
    New Jersey, United States
    MS-Off Ver
    Excel 2010, 2013
    Posts
    120

    Re: Concatenate variable # of columns

    I may not be understanding your issue completely, but can you use this?

    =TRIM(B2&" "&C2&" "&D2&" "&E2&" "&F2&" "&G2)

  4. #4
    Registered User
    Join Date
    11-12-2015
    Location
    Boston, MA
    MS-Off Ver
    2013
    Posts
    5

    Re: Concatenate variable # of columns

    THANK YOU @Tony Valko! This worked amazing! I can't even tell you how much time this will save me in the long run *cue happy dance at desk*!!

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Concatenate variable # of columns

    You're welcome. Thanks for the feedback!

+ 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. Concatenate formula for variable columns
    By davidktilley in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-05-2014, 07:08 PM
  2. [SOLVED] Macro to concatenate variable amount of columns
    By phil3061 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-15-2013, 02:53 PM
  3. Variable with Concatenate...
    By looeej in forum Excel General
    Replies: 3
    Last Post: 01-02-2013, 04:27 PM
  4. [SOLVED] VBA to Concatenate Variable Range
    By Leopard011 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-24-2012, 09:54 AM
  5. Variable name concatenate with array
    By Bmoe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-11-2010, 07:20 AM
  6. How to concatenate a variable with a Range
    By Glio in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 03-07-2008, 09:32 AM
  7. Replies: 3
    Last Post: 03-29-2005, 04:06 PM

Tags for this Thread

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