Need Help in VBA Codes

Manoj_Mishra

New Member
Joined
Oct 6, 2017
Messages
1
I have an excel sheet with multiple columns (A,B,C,D,E,F) below
[TABLE="width: 646"]
<tbody>[TR]
[TD]Date Worked[/TD]
[TD]Project[/TD]
[TD]Name[/TD]
[TD]Code[/TD]
[TD]Service Deliver[/TD]
[TD]Worked Hours[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Alfa[/TD]
[TD]Ram[/TD]
[TD]123[/TD]
[TD]Quality Check[/TD]
[TD]2.5[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Alfa[/TD]
[TD]Ram[/TD]
[TD]123[/TD]
[TD]No Work[/TD]
[TD]2.5[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Alfa[/TD]
[TD]XYZ[/TD]
[TD]579[/TD]
[TD]Quality Check[/TD]
[TD]2.5[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Alfa[/TD]
[TD]XYZ[/TD]
[TD]579[/TD]
[TD]No Work[/TD]
[TD]2.0[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Alfa[/TD]
[TD]ABC[/TD]
[TD]932[/TD]
[TD]Quality Check[/TD]
[TD]2.5[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Beta[/TD]
[TD]ABC[/TD]
[TD]932[/TD]
[TD]No Work[/TD]
[TD]2.5[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Beta[/TD]
[TD]Ram[/TD]
[TD]123[/TD]
[TD]Quality Check[/TD]
[TD]2.5[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Beta[/TD]
[TD]Ram[/TD]
[TD]123[/TD]
[TD]No Work[/TD]
[TD]2.5[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Alfa[/TD]
[TD]XYZ[/TD]
[TD]579[/TD]
[TD]Quality Check[/TD]
[TD]2.5[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Alfa[/TD]
[TD]XYZ[/TD]
[TD]579[/TD]
[TD]No Work[/TD]
[TD]2.5[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Gama[/TD]
[TD]ABC[/TD]
[TD]932[/TD]
[TD]Quality Check[/TD]
[TD]2.5[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Gama[/TD]
[TD]ABC[/TD]
[TD]932[/TD]
[TD]No Work[/TD]
[TD]2.0[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Gama[/TD]
[TD]Ram[/TD]
[TD]123[/TD]
[TD]Quality Check[/TD]
[TD]2.5
[/TD]
[/TR]
[TR]
[TD] I want to remove the duplicates rows by grouping data columns (A,B,C,D,E,) but summing the values in the G column corresponding to the repeating rows as shown in below image.

[TABLE="width: 646"]
<tbody>[TR]
[TD]Date Worked[/TD]
[TD]Project[/TD]
[TD]Name[/TD]
[TD]Code[/TD]
[TD]Service Deliver[/TD]
[TD]Worked Hours[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Alfa[/TD]
[TD]Ram[/TD]
[TD]123[/TD]
[TD]Quality Check[/TD]
[TD]7.5[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Alfa[/TD]
[TD]Ram[/TD]
[TD]123[/TD]
[TD]No Work[/TD]
[TD]2.5[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Beta[/TD]
[TD]Ram[/TD]
[TD]123[/TD]
[TD]No Work[/TD]
[TD]2.5[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Beta[/TD]
[TD]ABC[/TD]
[TD]932[/TD]
[TD]No Work[/TD]
[TD]2.5[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Gama[/TD]
[TD]ABC[/TD]
[TD]932[/TD]
[TD]No Work[/TD]
[TD]2.0[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Alfa[/TD]
[TD]ABC[/TD]
[TD]932[/TD]
[TD]Quality Check[/TD]
[TD]2.5[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Gama[/TD]
[TD]ABC[/TD]
[TD]932[/TD]
[TD]Quality Check[/TD]
[TD]2.5[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Alfa[/TD]
[TD]XYZ[/TD]
[TD]579[/TD]
[TD]Quality Check[/TD]
[TD]5.0[/TD]
[/TR]
[TR]
[TD]9/14/2017[/TD]
[TD]Alfa[/TD]
[TD]XYZ[/TD]
[TD]579[/TD]
[TD]No Work[/TD]
[TD]4.5[/TD]
[/TR]
</tbody><colgroup><col><col><col><col><col><col></colgroup>[/TABLE]



[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody><colgroup><col><col><col><col><col><col></colgroup>[/TABLE]
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
You could copy the data, remove duplicates in the first five columns, and use a formula:

[Table="width:, class:grid"][tr][td="bgcolor:#C0C0C0"][/td][td="bgcolor:#C0C0C0"]
A​
[/td][td="bgcolor:#C0C0C0"]
B​
[/td][td="bgcolor:#C0C0C0"]
C​
[/td][td="bgcolor:#C0C0C0"]
D​
[/td][td="bgcolor:#C0C0C0"]
E​
[/td][td="bgcolor:#C0C0C0"]
F​
[/td][td="bgcolor:#C0C0C0"]
G​
[/td][td="bgcolor:#C0C0C0"]
H​
[/td][td="bgcolor:#C0C0C0"]
I​
[/td][td="bgcolor:#C0C0C0"]
J​
[/td][td="bgcolor:#C0C0C0"]
K​
[/td][td="bgcolor:#C0C0C0"]
L​
[/td][td="bgcolor:#C0C0C0"]
M​
[/td][td="bgcolor:#C0C0C0"]
N​
[/td][/tr][tr][td="bgcolor:#C0C0C0"]
1​
[/td][td="bgcolor:#F3F3F3"]
Date Worked
[/td][td="bgcolor:#F3F3F3"]
Project
[/td][td="bgcolor:#F3F3F3"]
Name
[/td][td="bgcolor:#F3F3F3"]
Code
[/td][td="bgcolor:#F3F3F3"]
Service Deliver
[/td][td="bgcolor:#F3F3F3"]
Worked Hours
[/td][td][/td][td="bgcolor:#F3F3F3"]
Date Worked
[/td][td="bgcolor:#F3F3F3"]
Project
[/td][td="bgcolor:#F3F3F3"]
Name
[/td][td="bgcolor:#F3F3F3"]
Code
[/td][td="bgcolor:#F3F3F3"]
Service Deliver
[/td][td="bgcolor:#F3F3F3"]
Worked Hours
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
2​
[/td][td]
9/14/2017​
[/td][td]Alfa[/td][td]Ram[/td][td]
123​
[/td][td]Quality Check[/td][td]
2.5​
[/td][td][/td][td]
9/14/2017​
[/td][td]Alfa[/td][td]Ram[/td][td]
123​
[/td][td]Quality Check[/td][td="bgcolor:#E5E5E5"]
2.5​
[/td][td]M2: =SUMIFS($F$2:$F$14, $A$2:$A$14, H2, $B$2:$B$14, I2, $C$2:$C$14, J2, $D$2:$D$14, K2, $E$2:$E$14, L2)[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
3​
[/td][td]
9/14/2017​
[/td][td]Alfa[/td][td]Ram[/td][td]
123​
[/td][td]No Work[/td][td]
2.5​
[/td][td][/td][td]
9/14/2017​
[/td][td]Alfa[/td][td]Ram[/td][td]
123​
[/td][td]No Work[/td][td="bgcolor:#E5E5E5"]
2.5​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
4​
[/td][td]
9/14/2017​
[/td][td]Alfa[/td][td]XYZ[/td][td]
579​
[/td][td]Quality Check[/td][td]
2.5​
[/td][td][/td][td]
9/14/2017​
[/td][td]Alfa[/td][td]XYZ[/td][td]
579​
[/td][td]Quality Check[/td][td="bgcolor:#E5E5E5"]
5.0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
5​
[/td][td]
9/14/2017​
[/td][td]Alfa[/td][td]XYZ[/td][td]
579​
[/td][td]No Work[/td][td]
2.0​
[/td][td][/td][td]
9/14/2017​
[/td][td]Alfa[/td][td]XYZ[/td][td]
579​
[/td][td]No Work[/td][td="bgcolor:#E5E5E5"]
4.5​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
6​
[/td][td]
9/14/2017​
[/td][td]Alfa[/td][td]ABC[/td][td]
932​
[/td][td]Quality Check[/td][td]
2.5​
[/td][td][/td][td]
9/14/2017​
[/td][td]Alfa[/td][td]ABC[/td][td]
932​
[/td][td]Quality Check[/td][td="bgcolor:#E5E5E5"]
2.5​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
7​
[/td][td]
9/14/2017​
[/td][td]Beta[/td][td]ABC[/td][td]
932​
[/td][td]No Work[/td][td]
2.5​
[/td][td][/td][td]
9/14/2017​
[/td][td]Beta[/td][td]ABC[/td][td]
932​
[/td][td]No Work[/td][td="bgcolor:#E5E5E5"]
2.5​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
8​
[/td][td]
9/14/2017​
[/td][td]Beta[/td][td]Ram[/td][td]
123​
[/td][td]Quality Check[/td][td]
2.5​
[/td][td][/td][td]
9/14/2017​
[/td][td]Beta[/td][td]Ram[/td][td]
123​
[/td][td]Quality Check[/td][td="bgcolor:#E5E5E5"]
2.5​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
9​
[/td][td]
9/14/2017​
[/td][td]Beta[/td][td]Ram[/td][td]
123​
[/td][td]No Work[/td][td]
2.5​
[/td][td][/td][td]
9/14/2017​
[/td][td]Beta[/td][td]Ram[/td][td]
123​
[/td][td]No Work[/td][td="bgcolor:#E5E5E5"]
2.5​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
10​
[/td][td]
9/14/2017​
[/td][td]Alfa[/td][td]XYZ[/td][td]
579​
[/td][td]Quality Check[/td][td]
2.5​
[/td][td][/td][td]
9/14/2017​
[/td][td]Gama[/td][td]ABC[/td][td]
932​
[/td][td]Quality Check[/td][td="bgcolor:#E5E5E5"]
2.5​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
11​
[/td][td]
9/14/2017​
[/td][td]Alfa[/td][td]XYZ[/td][td]
579​
[/td][td]No Work[/td][td]
2.5​
[/td][td][/td][td]
9/14/2017​
[/td][td]Gama[/td][td]ABC[/td][td]
932​
[/td][td]No Work[/td][td="bgcolor:#E5E5E5"]
2.0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
12​
[/td][td]
9/14/2017​
[/td][td]Gama[/td][td]ABC[/td][td]
932​
[/td][td]Quality Check[/td][td]
2.5​
[/td][td][/td][td]
9/14/2017​
[/td][td]Gama[/td][td]Ram[/td][td]
123​
[/td][td]Quality Check[/td][td="bgcolor:#E5E5E5"]
2.5​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
13​
[/td][td]
9/14/2017​
[/td][td]Gama[/td][td]ABC[/td][td]
932​
[/td][td]No Work[/td][td]
2.0​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
14​
[/td][td]
9/14/2017​
[/td][td]Gama[/td][td]Ram[/td][td]
123​
[/td][td]Quality Check[/td][td]
2.5​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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