identify duplicates and sum corresponding values

A

Amanda

Hi there,

I only have 2 columns in my dataset but i have around 40,000 rows so i need
something relatively quick and easy! ID's are shown in column A and number of
days is shown in column B, there are duplicate ID's in A. I need to sum B
according to column A (i.e. for ID: 1 i need to add B1 and B2 to equal 13).
Can anyone help me with this?

A B
1 5
1 8
2 4
3 6
3 5
3 2

Thanks,
 
B

Bernard Liengme

In C1:C10 enter numbers 1 to 10
In D1 enter =SUMIF(A:A,C1,B:B)
Copy this down to D10
I am assuming ID are 1 to 10
I you have loots of unknown ID's use a pivot table
 
M

Max

One quick way is to use a pivot table (PT). Insert a top header row, label
in A1: ID, in B1: Days. Then select any cell within the source table, click
Data > PivotTable .... Click Next > Next. In step 3, click Layout, then drag
n drop ID within the ROW area, drag n drop Days within the DATA area (it'll
appear as Sum of Days), Click OK > Finish. That's it.

The PT will be created in a new sheet to the left, with the required
results, eg:

Sum of Days
ID Total
1 13
2 4
3 13
Grand Total 30
 
J

JMB

If column A is sorted, you could also consider Excel's Subtotal feature.

Data/Subtotals
 
A

Amanda

That's great... Thanks!
--
Amanda


Max said:
One quick way is to use a pivot table (PT). Insert a top header row, label
in A1: ID, in B1: Days. Then select any cell within the source table, click
Data > PivotTable .... Click Next > Next. In step 3, click Layout, then drag
n drop ID within the ROW area, drag n drop Days within the DATA area (it'll
appear as Sum of Days), Click OK > Finish. That's it.

The PT will be created in a new sheet to the left, with the required
results, eg:

Sum of Days
ID Total
1 13
2 4
3 13
Grand Total 30
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top