Sum if Rows Match

dhewett

New Member
Joined
Nov 22, 2023
Messages
9
Office Version
  1. 365
Platform
  1. Windows
I have a table that records revenue by project (Column B). The table has two revenue types(Columns L & N) that feed a total revenue column (Column K). Each revenue type is broken out by project on a separate line. Some projects may only have revenue type, thus only one line, where others contain both types and require two lines.

How can I sum Columns L & N in Column from all rows that match Column B while also totaling single rows in Column K?

Screenshot 2024-01-08 112019.png
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Here is one way, for data on rows 2:9 (I wasn't going to recreate your whole sheet by hand, so just a sample of the first 8 rows).

Formula to put in cell C2 and copy down to C9:
Excel Formula:
=SUMPRODUCT(--(B$2:B$9=B2),(D$2:D$9+E$2:E$9))

1704738231314.png


Adjust to suit your range.
 
Upvote 0
Solution
Would something like this work?:

Book1
BLMNOPQR
1ProjectRevenue Type 1Revenue Type 2
220-208266,370.00
320-208140,830.00
421-115491,920.00
521-115251,130.00
621-13656,630.00
721-303271,480.00
821-3951,262,480.00
921-3953,117,000.00
10
11ProjectTotal RevenueRevenue Type1Revenue Type2
1220-208407,200.00266,370.00140,830.00
1321-115743,050.00491,920.00251,130.00
1421-13656,630.0056,630.00-
1521-303271,480.00271,480.00-
1621-3954,379,480.001,262,480.003,117,000.00
Sheet1
Cell Formulas
RangeFormula
O12:O16O12=UNIQUE(FILTER(B2:B20,B2:B20<>""))
P12:P16P12=SUM(FILTER($L$2:$M$20,$B$2:$B$20=O12))
Q12:Q16Q12=SUM(FILTER($L$2:$L$20,$B$2:$B$20=O12))
R12:R16R12=SUM(FILTER($M$2:$M$20,$B$2:$B$20=O12))
Dynamic array formulas.
 
Upvote 0
Here is one way, for data on rows 2:9 (I wasn't going to recreate your whole sheet by hand, so just a sample of the first 8 rows).

Formula to put in cell C2 and copy down to C9:
Excel Formula:
=SUMPRODUCT(--(B$2:B$9=B2),(D$2:D$9+E$2:E$9))

View attachment 104606

Adjust to suit your range.
That worked perfectly. Thank you!
 
Upvote 0
You are welcome.
Glad we were able to help!
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,722
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top