if row is completely same with other rows mention the details in sheet2

cell highlighted in yellow colour are row number,this highlighted colour is only for understanding purpose in actual file there will be no highlighted colour
compare complete rows if rows are completely same then mention the row number in sheet2
row highlighted in green colour are complete rows
kindly see the sample file
Book15.xlsm
Avinash SinghAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Try this.
29098229.xlsm
0
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You may try something like this...
Sub CompareRows()
Dim sws As Worksheet, dws As Worksheet
Dim lr As Long, lc As Long, i As Long, j As Long
Dim x, y(), dict, dict1, it
Dim str As String

Application.ScreenUpdating = False
Set sws = Sheets("Sheet1")
Set dws = Sheets("Sheet2")

lr = sws.Cells(Rows.Count, 1).End(xlUp).Row
Set dict = CreateObject("Scripting.Dictionary")
Set dict1 = CreateObject("Scripting.Dictionary")

For i = 2 To lr
    lc = sws.Cells(i, Columns.Count).End(xlToLeft).Column
    x = sws.Range(sws.Cells(i, 2), sws.Cells(i, lc)).Value
    
    If IsArray(x) Then
        str = Join(Application.Index(x, 1, 0), ",")
    Else
        str = x
    End If
    
    If Not dict.exists(str) Then
        dict.Item(str) = sws.Cells(i, 1)
        dict1.Item(sws.Cells(i, 1).Value) = ""
    Else
        dict1.Item(sws.Cells(i, 1)) = dict.Item(str)
        dict1.Item(dict.Item(str)) = sws.Cells(i, 1)
    End If
Next i

ReDim y(1 To dict1.Count, 1 To 2)
For Each it In dict1.keys
    j = j + 1
    y(j, 1) = it
    y(j, 2) = dict1(it)
Next it
dws.Range("A2").CurrentRegion.Clear
dws.Range("A2").Resize(j, 2).Value = y
End Sub

Open in new window


In the attached, click on the button called "Compare Rows" on Sheet2 to run the code.
CompareRows.xlsm
0
Avinash SinghAuthor Commented:
kindly see this sample file i want the details in this way
Book1.xlsm
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Okay, give this a try...


Sub CompareRows()
Dim sws As Worksheet, dws As Worksheet
Dim lr As Long, lc As Long, i As Long, j As Long
Dim x, y(), dict
Dim str As String

Application.ScreenUpdating = False
Set sws = Sheets("Sheet1")
Set dws = Sheets("Sheet2")

lr = sws.Cells(Rows.Count, 1).End(xlUp).Row
Set dict = CreateObject("Scripting.Dictionary")

For i = 2 To lr
    lc = sws.Cells(i, Columns.Count).End(xlToLeft).Column
    x = sws.Range(sws.Cells(i, 2), sws.Cells(i, lc)).Value
    
    If IsArray(x) Then
        str = Join(Application.Index(x, 1, 0), ",")
    Else
        str = x
    End If
    
    If Not dict.exists(str) Then
        dict.Item(str) = sws.Cells(i, 1)
    Else
        dict.Item(str) = dict.Item(str) & "," & sws.Cells(i, 1)
    End If
Next i

ReDim y(1 To lr, 1 To 2)

For i = 2 To lr
    lc = sws.Cells(i, Columns.Count).End(xlToLeft).Column
    x = sws.Range(sws.Cells(i, 2), sws.Cells(i, lc)).Value
    
    If IsArray(x) Then
        str = Join(Application.Index(x, 1, 0), ",")
    Else
        str = x
    End If
    
    y(i - 1, 1) = sws.Cells(i, 1)
    y(i - 1, 2) = Replace(Replace(dict.Item(str), sws.Cells(i, 1), ""), ",,", ",")
    If Left(y(i - 1, 2), 1) = "," Then y(i - 1, 2) = Right(y(i - 1, 2), Len(y(i - 1, 2)) - 1)
Next i
dws.Range("A2").CurrentRegion.Clear
dws.Range("A2").Resize(lr, 2).Value = y
dws.Range("B2:B" & lr).TextToColumns , xlDelimited, , , , , True
End Sub

Open in new window

CompareRows-v2.xlsm
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Avinash SinghAuthor Commented:
Thnx Neeraj sir for ur great support and thnx again for giving ur precious time to this post
0
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You're welcome Avinash! Glad it worked as desired.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.