简体   繁体   中英

EXCEL: How to sum many cells/ values corresponding to another “merged” cell?

在此处输入图片说明

Hello :)

I have a similar table to the attached picture. I want to sum the total cost for every project and add these values in the column "total cost" without doing it manually, because my database is really huge.

Could anyone help me in this regard?

Put this in C2 and copy down:

=IF(OR(A3<>"",B3 = ""),SUM($B$2:B2)-SUM($C$1:C1),"")

在此处输入图片说明


If you want it on the first line then:

=IF(A2<>"",SUM(B2:B$104000)-SUM(C3:C$104000),"")

In C2 and copy down.

在此处输入图片说明


If you want it in everyrow:

=IF(A2<>"",SUM(B2:B$104000)-SUMIF(A3:A$104000,"<>",C3:C$104000),C1)

In C2 and copy down.

在此处输入图片说明

This sounds very much like the "Data", "SubTotals" feature. Did you try this already?

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