Summaries results in a filtered table

russelldt

Board Regular
Joined
Feb 27, 2021
Messages
160
Office Version
  1. 365
Platform
  1. MacOS
I have a table (columns B to e) that is linked to a source excel file. The following code filters the data in Column C, to only display the relevant entries.


VBA Code:
Private Sub Workbook_Open()
    With Sheets("Invoice log")
        .AutoFilterMode = False
        .Range("C3", .Range("C" & Rows.Count).End(xlUp)).AutoFilter Field:=1, Criteria1:=Sheets("Cashflow input").Range("E3").Value
    End With
End Sub

All goo.

Now I want to modify this script to summarize the Values that have been filtered, by the Name in column B.
 
Last edited by a moderator:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
When posting vba code in the forum, please use the available code tags. It makes your code much easier to read/debug & copy. My signature block below has more details. I have added the tags for you this time. 😊


We have no idea what your data is like so if what I have below is no help what about a small representative set of sample data with XL2BB and explain the expected results in relation to that.

Does it have to be vba and is the filtering vba you already have there just to get the summary you are wanting?

If the actual AutoFilter is not required, could you use a formula approach like below? As best I can guess at this stage that is the sort of result you are after.

'Cashflow input' Range E3 contains the value 25.

russeelldt.xlsm
BCDEFGHIJ
3NameCDENameCDE
4Name 1253955Name 17581160
5Name 2254124Name 275112100
6Name 3802348Name 4257058
7Name 1803643
8Name 2252938
9Name 3804944
10Name 1252780
11Name 2254238
12Name 3802933
13Name 4257058
14Name 1251525
15Name 3802321
16Name 3808017
17
Invoice log
Cell Formulas
RangeFormula
G4:G6G4=UNIQUE(SORT(FILTER(B4:B1000,C4:C1000='Cashflow input'!E3,"")))
H4:J6H4=SUMIFS(C4:C1000,$C4:$C1000,'Cashflow input'!$E3,$B4:$B1000,$G4#)
Dynamic array formulas.


If the requirement definitely is for vba then please confirm the sort of data and how it should be summarised (XL2BB is best again) as well as explaining where the summary should be.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,746
Messages
6,180,705
Members
452,994
Latest member
Janick

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