简体   繁体   中英

Remove Duplicates and Sum Formula

I have a set of data that will change so I need a formula to dynamically get a result.

From this set of data I end up with two columns, Dates and Amounts, like the following:

当前

What I need is to be able to remove the duplicates from the Dates column, while summing the corresponding amounts. So each unique date will have its own row with an amount that is a sum of all the amounts with this date. Desired Result:

结果

How would I go about this? Can I do it in a formula or do I need VBA?

Fairly new to excel, thanks in advance.

As an alternative to pivot tables in C1 enter:

=MIN(A1:A100)

In C2 enter the array formula:

=IF(MIN(IF($A$1:$A$100>C1,$A$1:$A$100))<C1,"",MIN(IF($A$1:$A$100>C1,$A$1:$A$100)))

and copy down.
Apply a Date format to column C .
Column C extracts the unique dates from column A .

In D1 enter:

=SUMPRODUCT(--($A$1:$A$100=C1)*($B$1:$B$100))

and copy down:

在此处输入图片说明

Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key. If this is done correctly, the formula will appear with curly braces around it in the Formula Bar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM