Link to home
Start Free TrialLog in
Avatar of Milind Agarwal
Milind AgarwalFlag for United States of America

asked on

Help in mergin two excel sheet and finding the difference.

Hello All,
Working on an excel problem any help would be appreciated. I have two excel workbooks. WorkbookA and WorkbookB both of them have one spreadsheet with similar data. 1st requirement is to merge them group by patient ID and Event Name  and 2nd requirement is to find the difference if its there in each cell and highlight it. Please find the attachment for additional information.  I have them all in one excel workbook.

Thanks in advance.
Template1.xlsx
Avatar of Milind Agarwal
Milind Agarwal
Flag of United States of America image

ASKER

Some logic in comparison part
   
    Dim varSheetA As Variant
    Dim varSheetB As Variant
    Dim strRangeToCheck As String
    Dim iRow As Long
    Dim iCol As Long

 For iRow = LBound(varSheetA, 1) To UBound(varSheetA, 1)
        For iCol = LBound(varSheetA, 2) To UBound(varSheetA, 2)
            If varSheetA(iRow, iCol) = varSheetB(iRow, iCol) Then
            Else
             End If
        Next iCol
    Next iRow

End Sub
Avatar of Robberbaron (robr)
1. how do you want the merged worksheet to look ?  just join them all together ?

2. you indicated this is the first priority but then want to do a comparison ?  Is character case of concern ?

3. perhaps you mean..
   a. merge worksheets
   b. sort by PatientID, EventName , OnsetDate
   c. hightlight adjacent rows where the above sort items are the same ?
Hey,
The merged worksheet should look like the template sheet3 that I have in attachment. Considering Sheet1 as one workbook and sheet2 is another one. Sheet3 represents the merged one. I can do this easily in SQL but Macro isnt my area of expertise. Thanks
ASKER CERTIFIED SOLUTION
Avatar of Robberbaron (robr)
Robberbaron (robr)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial