+ Reply to Thread
Results 1 to 6 of 6

Comparision Macro Required

  1. #1
    Registered User
    Join Date
    04-12-2012
    Location
    Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    5

    Comparision Macro Required

    I have very urgent requirement of comparision.
    If anybody able to helps me with giving program code / macro then it will appreceited very much.
    Please help me anybody !!!!!!!!!!!!!!!!!!

    What to Do or my requirement :
    I need to compare 2 Text files contents.
    I have imported all the contents of these 2 files in a 2 columns respectively.

    I have to check :

    (START FROM 10th Row. & need to Column "A" contents against Column "B" contents).
    (Here C1 means - Column 1)

    "In short my requirement is - I have set of lines (with HeadLice at first Row in C1 ) & I have similar kind of set of Lines (with same Headline) in C2.
    I need to check the contents of other rows when Both Headlines are matching. When Headline Matches but - The row contents of C1 is not matching or not at all present in C2 then I need the BOth HeadLine & Unmatching rows contents.
    These set of lines are separated by blank rows. Blank rows may be 1,2,3...n. So We need to consider the First not blank cell content as Headline & rest other rows as sub contents (till next blank rows)."
    "I need only unmatched rows content with headline".

    Diff. possibilities :

    1). Take first Row content (call it as HeadLine) (We need to start searching after every each Blank row)
    search this C1-Row Content (i.e.HeadLine) in C2 .
    If matching found then give lightBlue Color to those both ROWS of C1 & C2. (It is for identification)
    (This content may available in 'nth" of C2 i.e. Column B.)

    2).When C1-Row Headline = C2-Row Headline then
    Check the other next Row contents in both column (check till upto next Blank cells only).
    The next C1-Row Content may avaliable in any of the C2-Row.
    If matches then in next column write "MATCHING" (in next column).
    Give Color Green for C1 rows & Yellow for C2 rows.

    3).When C1-Row Headline = C2-Row Headline BUT
    The ant next C1-Row Content is not matching with any of the C2-Row Content (check till upto next Blank cells only) then
    in next column write "NOT MATCHING".Give Color to for both column perticular cells.
    And
    In "REPORT" sheet print the
    a).HeadLine of c1 & HeadLine of c2 in 2 columns separatelty.
    b).Print those unmatched row contents (in respective column) below the respectie HeadLines (with color).
    3).Give the Count No. i.e. 1,2,3,......for each mis match findings.

    4).If any HeadLine from C1 is not at all matching (when it completes the searching in whole C2) then
    In "REPORT" sheet (uNder the column "TAG which are NOT PRESENT ANYWHERE IN C2") & print the
    a).HeadLine of c1 .

    5).some time only Headline may be there.
    Now we need to check the this Headline in C2,if found "no need to print in Report". if not fond then Print the Headline uNder the column "TAG which are NOT PRESENT ANYWHERE IN C2".
    6).If possible please recheck whether any HEADLINES from C2 is only present in C2.
    Means now take C2 Contents as master & cross check any additional HEADLINES are added in C2 or not .


    I think it is very big task but unfortunately I have to do this kind of work for 100 sheet(each sheet contents 25000 rows !!!!!!) which is having same kind of data.
    Last edited by ashok_kajagar; 06-07-2012 at 12:20 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Comparision Macro Required

    Why dont you attach a sample file?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    04-12-2012
    Location
    Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Comparision Macro Required

    I have attached the - excel sheet in which i have to do the comparision along with required form of result.

    "In short my requirement is - I have set of lines (with HeadLice at first Row in C1 ) & I have similar kind of set of Lines (with same Headline) in C2.
    I need to check the contents of other rows when Both Headlines are matching. When Headline Matches but - The row contents of C1 is not matching or not at all present in C2 then I need the BOth HeadLine & Unmatching rows contents.
    These set of lines are separated by blank rows. Blank rows may be 1,2,3...n. So We need to consider the First not blank cell content as Headline & rest other rows as sub contents (till next blank rows)."
    "I need only unmatched rows content with headline".
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    04-12-2012
    Location
    Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Comparision Macro Required

    I have attached the - excel sheet in which i have to do the comparision along with required form of result.

    Please help me. if possible can you send me the code/macro to my email id : arkajagar@gmail.com

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Comparision Macro Required

    I am not able to understand your requirement at all. Please try explaining with the help of the file. How are you concluding that the rows are "Matching"?

  6. #6
    Registered User
    Join Date
    04-12-2012
    Location
    Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Comparision Macro Required

    I have attched the Excel Sheet (REQUIREMENT.xls) with examples & required form of output.
    Hope this below explanation will gives you the idea what I am looking from this excel sheet.
    ---------------------------------------------------------------------------------------------------

    STEPS TO FIND
    ------------------------------------------------------------------------------------
    In attached Excel I have marked with colors
    HEAD LINE- Blue Color
    Sub rows after Head Line (in Column-1) - Green Color. (It means Matching found)
    Sub rows after Head Line (in Column-2) - Yellow Color.(It means Matching found)
    Sub rows after Head Line (in Column-2) - Light Red Color (It means Matching not found)

    ------------------------------------------------------------------------------------
    CASE-A
    ------------------------------------------------------------------------------------
    1)Goto 1st Column-A (C1) & Copy the Cell content which appears after find 1st Blank row. Here C1 is OUR master column.
    e.g.BEGIN DB (it is present in Row-3)- Call it as HEAD LINE
    Calculate how many sub rows are there after this "BEGIN DB" row (in this case rows are. so total 4 rows including BEGIN DB row).
    In this case it is present at 3rd row.
    2).Find this "BEGIN DB" in 2nd Column-B (C2).
    3).When it matches anywhere in C2 then.
    Calculate how many sub rows are there after this "BEGIN DB" row (in this case rows are. so total 4 rows including BEGIN DB row).
    In this case it is present at 21st row.
    4).From C1 try to search 2nd row content (i.e. after BEGIN DB means "Descr") in Column 2 (Search FROM ROW 21st TO 24th ROW).
    It may appear anywhere in after 21st Row of C2 to 24th row.
    5).If we found then put comment "MATCHING" in column-C against C1 row.
    Here "Descr" appears at 4th row of C1 so "MATCHING" comment should be printed in column-C of 4th row.
    Like wise seaching will be done.
    -----------------------------------------------------------------------------------

    When We found MisMatch
    -----------------------------------------------------------------------------------
    6).Cell content of 6th row of C1 i.e. "Language Frech" check this one in C2 from 21st row to 24th Row.
    We dont find any matching.
    Now "NOT MATCHING" comment should be printed in column-C of 6th row.
    7).Goto "REPORT" sheet & print out put as below:
    "BEGIN DB" from Row-3 of C1 in column-A
    "BEGIN DB" from Row-21 of C2 in column-B

    "Language Frech" from Row-6 of C1 in column-A (after "BEGIN DB" row)
    "Language English" from Row-24 of C2 in column-B (after "BEGIN DB" row)
    ------------------------------------------------------------------------------------

    CASE-B
    ------------------------------------------------------------------------------------
    1).From 15th of C1 i.e. "TAG-1" is doesnot containing any sub rows
    Just search this "TAG-1" in C2. In this case it appears at 13th of C2.
    if it matches then print "MATCHING" in column-C of 15th row.

    2).From 18th of C1 i.e. "PC1.1" is doesnot containing any sub rows
    Just search this "PC1.1" in C2. In this case it appeaing anywhere in C2.
    if it not matches then print "NOT FOUND" in column-C of 18th row.

    Now goto "REPORT" sheet.
    ------------------------------------

    In "REPORT" sheet in Column-D , print "PC1.1"
    ---------------------------------------------------------------------------------------------------------
    Attached Files Attached Files
    Last edited by ashok_kajagar; 06-07-2012 at 11:55 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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