Question

Is there a way to add cells in MS Excel that do have another column matching.

Here is what I mean by matching column. How do I add the values in Numbers to add where the values in Matching Column is similar so that the results in column c would be the sum of rows 1 and 2 =50, 3 and 4=66, 5 and 6=187.

Thanks

  A               | B               | C
   ----------------|-----------------|----
   Matching Column | Numbers to add  |Sum
   ----------------|-----------------|----
1. 1               | 20              | 
2. 1               | 30              |50
3. 2               | 10              |
4. 2               | 56              |66
5. 3               | 67              |
6. 3               | 120             |187
Was it helpful?

Solution

You can try this formula:

=IF(A1=A2;"";SUMIF($A$1:$A$6;A1;$B$1:$B$6))

Write the formula in C1 and then copy down

OTHER TIPS

Dim i As Integer
Dim flagChanged As Boolean
Dim dblSum As Double

dblSum = Cells(1, 2)
For i = 2 To 7
    If Cells(i, 1) <> Cells(i - 1, 1) Then
        Cells(i - 1, 3) = dblSum
        dblSum = Cells(i, 2)

    Else
        dblSum = dblSum + Cells(i, 2)
    End If
Next i
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top