Nesting FILTER function inside of the AGGREGATE function?

diversification

New Member
Joined
Jun 24, 2020
Messages
37
Office Version
  1. 365
Platform
  1. Windows
Hi there, I have a data set that looks like what I've written, below. I want Row 1 of this Sheet to have a totaling column that will:

1. Sum all values below Row 1 within their column
2. Exclude any Rows that contain the word "total" in Column A
3. Exclude any Rows that I hide manually or hide by filtering

I was successful writing a formula to complete 1 & 2, but 3 is posing an issue.

Here's the formula to meet requirements 1 and 2 (it references only Column C, but I have it dragged across Row 1):
SQL:
=SUM(FILTER(C$2:C$100, (ISNUMBER(C$2:C$100))*(ISERROR(SEARCH("total",$A2:$A100)))))

To complete requirement 3, I had planned on replacing SUM with AGGREGRATE in the following manner:

SQL:
=AGGREGATE(9,3,FILTER(C$2:C$100, (ISNUMBER(C$2:C$100))*(ISERROR(SEARCH("total",$A2:$A100)))))

Unfortunately, this doesn't work and reports some sort of error when I try to use it. Does anyone have any alternative suggestions?

DateTypeQuantityCost
11/1/2022Orange1005000
12/24/2022Blue5010000
1/1/2023Green1501000
SubTotal:30016000
DateTypeQuantityCost
12/17/2022Purple500050
Subtotal:500050
Total:530016050
My goal is to nest AGGREGATE and FILTER functions to allow me to apply filters to a column of data, and then
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Unfortunately, the aggregate function does not accept an array for functions such as SUM, AVERAGE, COUNT, etc. It will only accept one for functions such as LARGE, SMALL, etc. Therefore, try the following formula instead...

Excel Formula:
=SUM(FILTER(C$2:C$11,SUBTOTAL(109,OFFSET($A$2:$A$11,ROW($A$2:$A$11)-ROW($A$2),0,1))))

Note that the formula returns #CALC! when no row meets the criteria. To return 0 instead, try the following formula...

Excel Formula:
=SUM(FILTER(C$2:C$11,SUBTOTAL(109,OFFSET($A$2:$A$11,ROW($A$2:$A$11)-ROW($A$2),0,1)),0))

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

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