Summing up data from groups & pasting it another column

Solved/Closed
V1R4L
Posts
3
Registration date
Tuesday March 12, 2013
Status
Member
Last seen
March 12, 2013
- Mar 12, 2013 at 04:58 AM
rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
- Mar 13, 2013 at 06:36 AM
Hello there,

I need to write a macro for the following example:

A 2
A 3
A 3
B 4
B 1
B 4
C 7
D 3
D 8
Etc.

Basicallly i need to sum up group A, B, C, D, E etc. and have the result displayed in the third column in the same sheet like this:

A 2
A 3
A 3 8
B 4
B 1
B 4 9
C 7 7
D 3
D 8 11

Can anyone give me some pointers on how to achieve such a thing?
Thanks in advance

1 reply

rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
769
Mar 12, 2013 at 11:34 AM
let say
your letters are in column A, starting from row 1
and your numbers are in column B, starting from row 1

and you want sum to show in column C, then use this in cell C1 and copy down
=IF(COUNTIF(A:A,A1)=COUNTIF(A$1:A1,A1),SUMIF(A:A,A1,B:B),"")
2
V1R4L
Posts
3
Registration date
Tuesday March 12, 2013
Status
Member
Last seen
March 12, 2013

Mar 12, 2013 at 10:41 PM
I had to change the , into ; but when i did that it worked like a charm.

This made my day way easyer, thank you so much!

Edit: the code that worked for me was: =IF(COUNTIF(A:A;A1)=COUNTIF(A$1:A1;A1);SUMIF(A:A;A1;B:B);)
0
rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
769
Mar 13, 2013 at 06:36 AM
you are quite welcome
0