MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Problem totalling 2 columns

Posted by Dave M on July 24, 2001 6:46 AM


I have a problem, I cannot find a way of totalling 2 columns as follows:

ID hours
op1 4
op2 5
op2 6
op3 5
op1 5
op2 8
op3 9

I want to gather that data together so i get the result

op1 9
op2 19
op3 14

Any help greatly appreciated

Posted by Aladin Akyurek on July 24, 2001 6:55 AM


Let assume that these 2 columns A and B both starting in row 2 (that is, A2=op1, B2=4 and so on.

Enter the distinct op codes columnwise from say C2 on.

In D2 enter: =SUMIF($A$2:$A$8,C2,$B$2:$B$8)

Copy down this formula up to the last row in C that contains an op code.