Here is my data in sheet1 of excel:

## A B

A1 20

A2 2

A1 2

A3 3

Consider the above in an excel sheet. Column A contains duplicate keys and Column B contains quantity. my requirement is, I need a function in Excel which can add values of B for unique values of column A.

so output should be

Sheet 2:

## A B

A1 22

A2 2

A3 3

Has anyone worked with such a requirement?

thanks.