Billy Hill
Board Regular
- Joined
- Dec 21, 2010
- Messages
- 73
I have data to compare in 2 columns to find a match then sum the qty of those rows.
In the below example I have a part number, a location and a quantity sorted by part number then location.
I want to:
-Find where the part number and location are the same
-Add the sum of the QTY for the duplicates and replace the QTY of one of the found items with the sum
-Delete the remaining found duplicates
PartNo Location QTY
1411204 INT-KULIM 1.00
1411205 INT-AZ 1.00
1411205 INT-CHENDU 2.00
1411205 INT-ISRL 1.00
1411205 INT-JF 1.00
1411205 INT-KULIM 1.00 <--- same pn and location
1411205 INT-KULIM 1.00 <--- same pn and location
1411243 INT-AZ 2.00
1411243 INT-CHENDU 1.00
1411243 INT-JF 1.00
1411243 INT-KULIM 1.00 <--- same pn and location
1411243 INT-KULIM 1.00 <--- same pn and location
1411243 INT-KULIM 1.00 <--- same pn and location
1411335 INT-KULIM 3.00
1502160 INT-ISRL 12.00
1502523 INT-AZ 1.00
In the above table, I want to replace the 2 instances of Part Number 1411205 that are in INT-KULIM with 1 instance of the same line but have the Sum of QTY instead of the original.
The new table would look like this:
PartNo Location QTY
1411204 INT-KULIM 1.00
1411205 INT-AZ 1.00
1411205 INT-CHENDU 2.00
1411205 INT-ISRL 1.00
1411205 INT-JF 1.00
1411205 INT-KULIM 2.00 <--- were 2 line items, now one with total
1411243 INT-AZ 2.00
1411243 INT-CHENDU 1.00
1411243 INT-JF 1.00
1411243 INT-KULIM 3.00 <--- Were 3 line items, now one with total
1411335 INT-KULIM 3.00
1502160 INT-ISRL 12.00
1502523 INT-AZ 1.00
Is this possible using VBA or a formula or...?
In the below example I have a part number, a location and a quantity sorted by part number then location.
I want to:
-Find where the part number and location are the same
-Add the sum of the QTY for the duplicates and replace the QTY of one of the found items with the sum
-Delete the remaining found duplicates
PartNo Location QTY
1411204 INT-KULIM 1.00
1411205 INT-AZ 1.00
1411205 INT-CHENDU 2.00
1411205 INT-ISRL 1.00
1411205 INT-JF 1.00
1411205 INT-KULIM 1.00 <--- same pn and location
1411205 INT-KULIM 1.00 <--- same pn and location
1411243 INT-AZ 2.00
1411243 INT-CHENDU 1.00
1411243 INT-JF 1.00
1411243 INT-KULIM 1.00 <--- same pn and location
1411243 INT-KULIM 1.00 <--- same pn and location
1411243 INT-KULIM 1.00 <--- same pn and location
1411335 INT-KULIM 3.00
1502160 INT-ISRL 12.00
1502523 INT-AZ 1.00
In the above table, I want to replace the 2 instances of Part Number 1411205 that are in INT-KULIM with 1 instance of the same line but have the Sum of QTY instead of the original.
The new table would look like this:
PartNo Location QTY
1411204 INT-KULIM 1.00
1411205 INT-AZ 1.00
1411205 INT-CHENDU 2.00
1411205 INT-ISRL 1.00
1411205 INT-JF 1.00
1411205 INT-KULIM 2.00 <--- were 2 line items, now one with total
1411243 INT-AZ 2.00
1411243 INT-CHENDU 1.00
1411243 INT-JF 1.00
1411243 INT-KULIM 3.00 <--- Were 3 line items, now one with total
1411335 INT-KULIM 3.00
1502160 INT-ISRL 12.00
1502523 INT-AZ 1.00
Is this possible using VBA or a formula or...?