+ Reply to Thread
Results 1 to 2 of 2

Combine lines that have one cell matching?

  1. #1
    Registered User
    Join Date
    07-21-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    1

    Question Combine lines that have one cell matching?

    This may be an easy one, but I just can't think of how to accomplish this.

    I have two sheets, both with different columns, except one column that is an 'ID'. This ID is what matches the info in sheet 1 with the info in sheet 2.
    What I need to do is combine the sheets so that sheet two adds its columns to the end of sheet one, but each row must match the specific column that the row is associated with. BUT the lines are not equal in each sheet, meaning its possible for an ID on sheet 1 to not have a row in sheet 2.

    For example:

    Sheet 1: A1(ID)=1234, B1=red, C1=Blue D1=Purple
    Sheet 2: A14(ID)=1234, B14=Dog, C14=Cat, D14=Banana

    What I want the end result to be is:

    Sheet 1: A1(ID)=1234, B1=red, C1=Blue D1=Purple, E1=Dog, F1=Cat, G1=Banana

    So it adds the info from sheet two to the end of the correct line in sheet one, based on the ID matching.

    Is this possible??? There are way too many lines to do manually without going crazy.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Combine lines that have one cell matching?

    1) On sheet1, put this formula in E1:

    =IF(ISNUMBER(MATCH($A1, Sheet2!$A:$A, 0)), INDEX(Sheet2!B:B, MATCH($A1, Sheet2!$A:$A, 0)), "")&""

    2) Copy that cell down and across as far as needed, even more than 3 columns if you wish.

    3) Highlight the full columns you added, for instance E:G

    4) Copy

    5) While it's still highlighted, do a PASTE SPECIAL > VALUES to remove the formulas and leave the data.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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 do I combine multiple lines of information into a single cell, separated by commas?
    By ilostar in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-22-2012, 11:48 AM
  2. Combine cell value to one cell based on Row matching
    By harryisurs in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-24-2012, 02:59 AM
  3. Replies: 1
    Last Post: 01-09-2010, 09:12 PM
  4. Combine several lines of text into one cell
    By deaexcelpadawan in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-27-2008, 05:38 AM
  5. combine lines
    By mchipser in forum Excel General
    Replies: 3
    Last Post: 10-10-2008, 03:13 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