+ Reply to Thread
Results 1 to 9 of 9

match columns and rows from one sheet to another sheet

  1. #1
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    match columns and rows from one sheet to another sheet

    I have 2 sheets "Main" and "Received"
    Both the Sheets has contains details of family as per the heading
    Family id will be unique for one particular family.

    I want to compare the details of family (Column wise and row wise in respective) in sheet "Main" with sheet "Received"
    If particular family details are matching in both the sheets, then in Sheet "Main" in Column "J" (Status) I wants result as all the details area matched.

    For Example
    Family code "053221" in main sheet is Matching with Received sheet. All details area matching Like family id, Members name, age, DOB etc. Hence in status column Marked as "ALL DETAILS MATCHED"

    Family code "023372" in main sheet is not Matching with Received sheet. The Difference is in name of the second family member. Hence in status column Marked as "NOT MATCHED"

    Family code "019340" in main sheet is not Matching with Received sheet. The Difference is in total number of family member. Hence in status column Marked as "NOT MATCHED"

    Matching Criteria to Mark status
    a) first check family id

    b) based on family id Check total Number of Family members
    if b is matching in both the sheets then move to next criteria, if not matching then mark status as details are not matched.

    c) based on family id Check total Name of all Family members
    if c) is matching both in both sheets then move to next criteria, if not matching then mark status as details are not matched.

    d) based on family id Check date of birthe of the Particular family member in both the sheets.
    if d) is matching both in both sheets then move to next criteria, if not matching then mark status as details are not matched.

    in same way match all other criteria like age, gender, relation and income group.

    If all the details are Matched then give status as " ALL Details are Matched"

    please find attached sheet for example. Differences are marked in red colour
    Attached Files Attached Files

  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: match columns and rows from one sheet to another sheet

    No vba is needed, you can achieve this in realtime by adding a KEY column to both sheet concatenating all of these key values into a single easy-test string. In column J of both sheets:

    =B2&"-"&C2&"-"&D2&"-"&E2&"-"&F2&"-"&G2&"-"&H2

    Then in the STATUS column K of Main:

    =IF(ISNUMBER(MATCH($J2, Received!$J:$J, 0)), "ALL DETAILS", "NOT") & " MATCHED"
    Attached Files Attached Files
    _________________
    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!)

  3. #3
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: match columns and rows from one sheet to another sheet

    little bit different with VBA


    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    Re: match columns and rows from one sheet to another sheet

    hi,
    The code shows results in only first 13 rows and thats too with wrong result.

    for example in main sheet row number 2 to 6 exactly matching with row number 2 to 6. then also result shows not matched.

    Please help
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    Re: match columns and rows from one sheet to another sheet

    Hi,
    Thank you very much for your code.

    I have asked for a vba code, because the formula work in all cases.

    For example in sheet main refer row number 7 and 8
    7 is matched and 8 is not matched. So the actual result should be as in column L.


    refer row number 18 to 23
    18 and 19 is matched and rest are not matched. So the actual result should be as in column L.

    In short if any one of the family member is not matched then entire family rows to be marked as not matched
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: match columns and rows from one sheet to another sheet

    See if this 1 is better
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    Re: match columns and rows from one sheet to another sheet

    leo Great!!!!

    It works. Thank you so much for the code.

    Can you help me with one more code.

    In same type of sheet can you provide code to identify the family details in the same sheet instead of two different sheets.

    Please find attached sheet for examples.

    leo Great!!!!

    It works. Thank you so much for the code.

    Can you help me with one more code.

    In same type of sheet can you provide code to identify the family details in the same sheet instead of two different sheets.

    Please find attached sheet for examples

    For Example:-

    Details of all family members of Family id 053221 is exist in the sheet for three times. Hence the first match is Markes as “MATCH FOUND” in “status” column in Column J

    First it is found in row number 2 to 6 – Marked as “MATCH FOUND”

    then found in 28 to 32 – Marked as “No Match FOUND” because there is a difference in age of one family member.

    Then found in row no. 38 to 42 – Marked as “Duplicate Match found” because it is exactly matching with Row no. 2 to 6 (in all details)

    So first Matching family to be marked as “MATCH FOUND” and Second Exactly Matching family to be Marked as “ DUPLICATE MATCH FOUND”
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    Re: match columns and rows from one sheet to another sheet

    Hi Leo,

    Can you make small change in the code. Just to Pull the Status columns in Both The Sheets "Main" and "Received"

    Need status in Both the column. The status should be same in Sheet "Received" again respective columns as in Sheet " Main"

  9. #9
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: match columns and rows from one sheet to another sheet

    Like this ?

    Kind regards
    Leo
    Attached Files Attached Files

+ 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: 0
    Last Post: 01-13-2013, 07:06 PM
  2. Replies: 0
    Last Post: 11-08-2012, 05:05 PM
  3. Match two Columns of two Sheets and Copy Matched Rows to a Third Sheet
    By Par in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-08-2012, 10:16 AM
  4. Replies: 0
    Last Post: 10-25-2012, 03:38 PM
  5. Two Columns must match in sheet one and sheet two then lookup column C
    By Pavan Kumar in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-18-2011, 11:32 AM
  6. Populate summary sheet (insert & index rows from info in columns on another sheet)
    By DerbysGal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-03-2011, 01:54 PM
  7. Match column from sheet 2 to sheet 1 and copy rows if match exists.
    By GravityInvert in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-28-2008, 01:42 PM

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