Summaries results in a filtered table

russelldt

Board Regular
Joined
Feb 27, 2021
Messages
158
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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
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
You're welcome. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,215,109
Messages
6,123,137
Members
449,098
Latest member
Doanvanhieu

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