[Excel Image 1](http://i.stack.imgur.com/Mio0N.png)

[Excel Image 2](http://i.stack.imgur.com/5oUDi.png)

Please look at the "Excel Image 1" to start.

I am using python to pull those first two columns, and storing them in their own separate array. What I want to do is add the values of column B if the value in column are the same. For ex: if the value in column A is "0", then add -200 and 400 and get 200 because "0" is in row 1 and row 2 of column A.

After the addition as shown in "Excel Image 2", store the new values of both the Column in their own separate arrays, so I can use them for later calculations.

```
import xlrd
excel = '/Users/Bob/Desktop/'

wb1 = xlrd.open_workbook(excel + 'assignment.xlsx')
sh1 = wb1.sheet_by_index(0)

colA,colB = [],[]
for a in range(0,sh1.nrows):
    colA.append(int(sh1.cell(a,0).value))
    colB.append(int(sh1.cell(a,1).value))
print(colA)
print(colB)

for i in colA:
    if i == 0:
        add = colB[0] + colB[1]
print(add)

```

I want a code that adds those values in column B irrespective of how many number or number of same values are given in column A.

Current output:

```
[0, 0, 1, 2, 2, 2, 3, 3, 4, 4]
[-200, 400, 30, 600, -70, 10, 20, -90, 40, 40]

```

Expected output:

```
[0, 1, 2, 3, 4]
[200, 30, 540, 70, 80]

```

Thanks!