+ Reply to Thread
Results 1 to 7 of 7

Compare 4 column values then insert a 5th columns value to a blank column/cell value

  1. #1
    Registered User
    Join Date
    10-26-2012
    Location
    Asheville, NC
    MS-Off Ver
    Excel 2010
    Posts
    3

    Question Compare 4 column values then insert a 5th columns value to a blank column/cell value

    Ok, I know the title is a little confusing but I will explain the function that I need to solve my problem completely.
    First, there is a sample Workbook attached to this message so you can get a general idea of the layout of the real Workbook.

    *** What I need the function to do ***

    1) I have a Workbook with 2 sheets.
    2) The first worksheet is called EMAIL_old and the second worksheet is called EMAIL_new.
    3) Worksheet EMAIL_old (first sheet of the attached example Workbook) has 4 columns named: New Email(A2:A21), Old Email 1(B2:B21), Old Email 2(C2:C21), Old Email 3(D2:D21)
    4) Worksheet EMAIL_new (second sheet of the attached example Workbook) has 2 columns: Old Email(A2:A21) and New Email(no cell values yet)
    5) I need to search B2:D21 (i.e. all values in Old Email 1, Old Email 2 and Old Email 3) from EMAIL_old and compare the values in all those columns with the value
    contained in EMAIL_new column Old Email(A2:A21 of the second sheet)
    6) If an email address is found anywhere in Old Email 1, Old Email 2, or Old Email 3 (i.e B:D of first worksheet), then the value of New Email(A2:A21 of the first worksheet)
    should be copied into the column New Email of EMAIL_new (B2:B21 of the second worksheet).
    7) If no match is found using the above test in Step 6, the value "NO MATCH" should be added to the New Email column (i.e. B2:B21 of the second worksheet)

    Examples from included Workbook that is attached to this message:
    1) The value of cell A2 (Old Email) in the EMAIL_new worksheet (i.e. the first column of the second worksheet) is [email protected]
    a) A search of Old Email 1 (B), Old Email 2 (C) and Old Email 3 (D) in the EMAIL_old worksheet (i.e. the 2nd,3rd and 4th columns of the first worksheet)
    shows that the value of cell B16 is [email protected]
    b) So that is a match as cell B16 (column Old Email 1) of EMAIL_old worksheet (i.e. the first worksheet) is
    equal to the value that is in cell A2 (Old Email) of EMAIL_new (i.e the second worksheet)
    c) So the value contained in cell A16 (jason4@company) (column New Email) of EMAIL_old (i.e. the first worksheet)
    should be inserted into cell B2 (New Email) of EMAIL_new (i.e. the second worksheet). So A16(sheet EMAIL_old) is [email protected] and B2 (sheet EMAIL_new) is [email protected]
    2) The value of cell A8 (Old Email) in the EMAIL_new worksheet (i.e. the first column of the second worksheet) is [email protected]
    a) A search of Old Email 1 (B), Old Email 2 (C) and Old Email 3 (D) in the EMAIL_old worksheet (i.e. the 2nd,3rd and 4th columns of the first worksheet)
    shows that the value [email protected] is not found anywhere in these columns.
    b) So that is NOT a match.
    c) So the value of cell B8 (New Email) of EMAIL_new (i.e. the send worksheet) should be set to "NO MATCH"

    I hope that I have made sense and that I didn't ramble too much. Feel free to reply to this thread if you need clarification.
    Attached Files Attached Files
    Last edited by JasonKMcCoy; 10-26-2012 at 05:53 PM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Compare 4 column values then insert a 5th columns value to a blank column/cell value

    this is a bit ugly, but it does the job, based on you'r requirements...
    Please Login or Register  to view this content.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    10-26-2012
    Location
    Asheville, NC
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Compare 4 column values then insert a 5th columns value to a blank column/cell value

    This is exactly what I need except that I need the value of column A of the first sheet inserted into the blank cell of column B of the second sheet if there is a match. Right now, your formula is inserting the value of column A of the second sheet into the blank cell of column B of the second sheet.

    For example: If you look at the first row in column A, sheet 2 of the workbook I included above the value of A2 is "[email protected]". Then we need to compare this value to all values in columns B,C,D of the first sheet to see if there is a match. In this case, there is a match found at B16 of the first sheet. So now that a match has been found, I need to have the value of A16 of the first sheet inserted into the blank cell B2 of the second sheet. Basically if a match is found in any cell of columns B,C,D of the first sheet, insert the value of column A that is on the same row that the match is found in the first sheet (so if instead the match had been found in C13, I would need to insert the value of A13 of the first sheet into the blank cell B2 of the second sheet, etc). I hope this makes sense. Thank you for your help and feel free to reply to this or email me if you need any more clarification. Jason

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Compare 4 column values then insert a 5th columns value to a blank column/cell value

    ok i think i underatand better now, try this...
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-26-2012
    Location
    Asheville, NC
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Compare 4 column values then insert a 5th columns value to a blank column/cell value

    Awesome, that is exactly what I needed. Thank you so much. This problem has been giving me fits.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Compare 4 column values then insert a 5th columns value to a blank column/cell value

    glad to help, and thanks for the rep

  7. #7
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Compare 4 column values then insert a 5th columns value to a blank column/cell value

    @ JasonKMcCoy

    Welcome to the forum.

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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