If Column A has duplicates then add the value in column D for the duplicates

EquipmentPartsSales

New Member
Joined
Sep 17, 2018
Messages
6
I have a large inventory file I am working with. The data looks like this:
[TABLE="width: 500"]
<tbody>[TR]
[TD]NSN[/TD]
[TD]Part number[/TD]
[TD]Condition[/TD]
[TD]QTY[/TD]
[TD]DESC[/TD]
[/TR]
[TR]
[TD]1005001950897[/TD]
[TD]11662739[/TD]
[TD]NS[/TD]
[TD]7[/TD]
[TD]MOTOR[/TD]
[/TR]
[TR]
[TD]1005001950897[/TD]
[TD]11662739[/TD]
[TD]NS[/TD]
[TD]2[/TD]
[TD]MOTOR[/TD]
[/TR]
[TR]
[TD]1005002676740[/TD]
[TD]368506201[/TD]
[TD]NS[/TD]
[TD]4[/TD]
[TD]HOUSING[/TD]
[/TR]
[TR]
[TD]1005005013201[/TD]
[TD]5013201[/TD]
[TD]NS[/TD]
[TD]1[/TD]
[TD]SPRING[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Basically what I would like to do is if the number in column NSN has a duplicate then add up the values in the QTY column. For this example it would like like this:
[TABLE="width: 500"]
<tbody>[TR]
[TD]NSN[/TD]
[TD]Part number[/TD]
[TD]Condition[/TD]
[TD]QTY[/TD]
[TD]DESC[/TD]
[TD]Total Qty[/TD]
[/TR]
[TR]
[TD]1005001950897[/TD]
[TD]11662739[/TD]
[TD]NS[/TD]
[TD]7[/TD]
[TD]MOTOR[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]1005001950897[/TD]
[TD]11662739[/TD]
[TD]NS[/TD]
[TD]2[/TD]
[TD]MOTOR[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1005002676740[/TD]
[TD]368506201[/TD]
[TD]NS[/TD]
[TD]4[/TD]
[TD]HOUSING[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1005005013201[/TD]
[TD]5013201[/TD]
[TD]NS[/TD]
[TD]1[/TD]
[TD]SPRING[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I do not know if there is a simple formula or a VBA code that will achieve this. My inventory list has roughly 200,000 lines. Any help would be greatly appreciated.
 
Another way to copy a formula down, is select the cell with the formula & double click on the little ∎ in the bottom right of the cell. This will fill down to the last used cell in the column to the immediate right.
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Yes, if you don't have any blank rows in between your data, Fluff's suggestion is the quickest way.
 
Upvote 0
No, not sounding rude at all, I just didn't know who you were talking to, and still don't know if my formula is working for you.

The other formula offered above Only does a COUNT of Column A, whereas, according to your description you want a SUM of Column D (Qty) for Duplicates in Column A, but ignore the unique NSN(s) in Column A (as my formula does).

Anyway, using my table in Post # 3 as sample, to quickly copy F2 formula All the Way to F200000:

1. Select F2, Right click, Copy
2. Hit F5, inside the "Reference" box, type F3:F200000
3. Hold down Shift, Click "OK"
4. Control V, the formula is now copied All the way down to F200000


Thank you for all the info I had to to use a VBA module in order to make it work. I am saving your countif formula for other uses. Thanks again.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

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