Compare two cells in one column and then add the value of their rows to the matched row

Moe99185

New Member
Joined
Aug 5, 2019
Messages
5
[FONT=&quot]Hello,
[/FONT]

[FONT=&quot] I have this problem, I have a excel work sheet that contains processes. There are some process with the same name inside the same column “F” which want to compare, because some of them are repeated in other rows. However, the other cells contain different data. What I want to do is to compare the cells in this column “F” and then if there is a match, I want to add the data of the matched-row to the first one and delete the second.
[/FONT]

[FONT=&quot]i.e if F = F then H = H + H and I = I +I, and then delete F which I extracted the data from.
[/FONT]

[FONT=&quot]
[/FONT]

[FONT=&quot]Can somebody please help figure this out?
[/FONT]
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Welcome to the MrExcel board!

Very hard to tell from that written description. Can you post some simple sample data and the expected results together with any further clarification that you can give?
My signature block below has a link with help on how to post small sets of sample data.
 
Upvote 0
i have coded this, but it is not optimale,

Private Sub CommandButton1_Click()


Dim lngRow As Long
Dim lngBegin As Long
Dim lngEnd As Long


lngRow = 2
lngBegin = 2
lngEnd = 25


For lngRow = lngBegin To lngEnd


If Cells(lngRow, 6) = Cells(lngRow + 1, 6) Then

Cells(lngRow, 7) = Cells(lngRow, 7) & ", " & Cells(lngRow + 1, 7)
Cells(lngRow, 8) = Cells(lngRow, 8) & ", " & Cells(lngRow + 1, 8)
Cells(lngRow, 9) = Cells(lngRow, 9) & ", " & Cells(lngRow + 1, 9)
Cells(lngRow, 10) = Cells(lngRow, 10) & ", " & Cells(lngRow + 1, 10)
Cells(lngRow, 11) = Cells(lngRow, 11) & ", " & Cells(lngRow + 1, 11)
Cells(lngRow, 12) = Cells(lngRow, 12) & ", " & Cells(lngRow + 1, 12)
Cells(lngRow, 13) = Cells(lngRow, 13) & ", " & Cells(lngRow + 1, 13)
Cells(lngRow, 14) = Cells(lngRow, 14) & ", " & Cells(lngRow + 1, 14)




Cells(lngRow, 6).Interior.ColorIndex = 10 'green
Cells(lngRow, 6).Font.Bold = True




Cells(lngRow + 1, 6) = ""
Cells(lngRow + 1, 7) = ""
Cells(lngRow + 1, 8) = ""
Rows(lngRow + 1).EntireRow.Delete




End If


Next lngRow




End Sub




now i have to fliter the six column and run the code for couple of times to get the results.
can you help me optimize the code
 
Upvote 0
Sorry, I'm afraid that I don't understand.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top