+ Reply to Thread
Results 1 to 5 of 5

Combine multiple First/Last Name columns into one column, data can contain blank rows

  1. #1
    Registered User
    Join Date
    08-02-2012
    Location
    Europe
    MS-Off Ver
    Excel 2013/365
    Posts
    24

    Combine multiple First/Last Name columns into one column, data can contain blank rows

    Hi,

    Been struggling with this over the last couple of days. I have reports that contain two separate sets of "First" and "Last" names in columns similar to the below example, except the reports can be thousands of rows long:

    set1_FirstName set1_LastName set2_FirstName set2_LastName
    Jenell P Judah
    Jaquelyn Wafford
    Leoma Shore

    The end goal is to merge all these First/Last names together into a new single combined "Full Name" column, keeping any blank rows that may have been present, like this:

    combined_FullName
    Jenell P Judah
    Jaquelyn Wafford
    Leoma Shore

    The two sets never have a data overlap, if names are in the first set the second set is always blank and/or vice versa.
    But either set can contain middle initials, have blank rows or in some cases be completely blank altogether.
    It's this variable nature I'm struggling with accounting for when merging the name sets together. A simple "=A2&" "&B2" type formula won't cut it.

    I have attached an example workbook that contains four sheets of the different scenarios that the reports can contain along with a full_name column with the expected result for each scenario.

    Thanks for any insight into this problem.
    Attached Files Attached Files
    Last edited by Tunesmith; 10-04-2016 at 09:57 AM. Reason: Solved

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Combine multiple First/Last Name columns into one column, data can contain blank rows

    In F2 (or whatever column you want to use for full name:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Then copy down

    The only difference is that your blank names contain one space and my formula would leave the cell completely blank, but that's easily changed by changing the second condition to " " instead of "". Like this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by Arkadi; 10-04-2016 at 09:02 AM.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Combine multiple First/Last Name columns into one column, data can contain blank rows

    If the data never overlaps the just concatenate all 4 fields together and then trim the result.
    Please Login or Register  to view this content.
    That way blank rows will trim to zero characters and others will trim the spaces before and after.
    If someone has helped you then please add to their Reputation

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Combine multiple First/Last Name columns into one column, data can contain blank rows

    Good call pjwhitfield, much more efficient!

  5. #5
    Registered User
    Join Date
    08-02-2012
    Location
    Europe
    MS-Off Ver
    Excel 2013/365
    Posts
    24

    Re: Combine multiple First/Last Name columns into one column, data can contain blank rows

    Quote Originally Posted by pjwhitfield View Post
    If the data never overlaps the just concatenate all 4 fields together and then trim the result.
    Please Login or Register  to view this content.
    That way blank rows will trim to zero characters and others will trim the spaces before and after.
    Simple!

    One scenario I can't get it to work properly yet though is if only "set 2" is populated with names. Has to do with the way I've been auto-filling the formulas up to now;

    Please Login or Register  to view this content.
    As I've been using "A" column to define how far the auto-fill should go this obviously doesn't work if A is blank, it'll end up auto-filling upwards into the header row.

    Ideas? It's a very rudimentary way of auto-filling I know.

    Edit: I worked around this problem by simply adding another column that is always 100% populated with the full range of the report and use that for figuring out the row count.

    Thank you guys.
    Last edited by Tunesmith; 10-04-2016 at 09:56 AM.

+ 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: 6
    Last Post: 11-25-2015, 01:01 PM
  2. Combine 2 Macros to Consolidate Data from Multiple Sheets and then Delete Blank Rows
    By butler1012 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-22-2015, 07:33 PM
  3. Combine Data in Multiple Columns to One Column Based on Data in Rows
    By exceldivx in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-09-2014, 07:35 AM
  4. Replies: 6
    Last Post: 02-19-2014, 10:25 AM
  5. [SOLVED] VBA Find last row and column that contain data and delete all blank rows and blank columns
    By bcn1988 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-03-2012, 01:07 PM
  6. [SOLVED] Combine multiple columns into two long columns, Repeating rows in first column
    By anasab@gmail.com in forum Excel General
    Replies: 0
    Last Post: 07-31-2006, 12:13 PM
  7. Replies: 6
    Last Post: 05-03-2006, 04:30 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