1

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.

1 Answers1

1

in sheet 2 place the following formula into cell B2 and drag down:

=SUMIF(Sheet1!A:A,Sheet2!A2,Sheet1!B:B)

Details

This says to check if column A from sheet1 has the key to my left.

If it does then return the sum of all the corresponding cells in column B that meet the requirement.