Excel Filtering for a Summary Tab

ItalianPlatinum

Well-known Member
Joined
Mar 23, 2017
Messages
880
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I have a 5k+ row sheet that contains Invoices, job Ids, Merchants, with Due Dates and Shipment dates among a lot of other unique data. I need a way to quickly and easily identify based off of year when something was shipped. I want to maintain one sheet lets call it data. Then be able to look at another sheet say (2024) or (2025) to reference right there automatically what has been shipped for that year. The sheet 2024 will have all the columns in the data tab that I populated. So essentially a summary filtered by Ship date of 2024. Would anyone be able to help? The user isn't very computer inclined so having them filter or advance filtering themselves is a no can do. I know Excel has FILTER and UNIQUE filter formulas that I think may work but I had issues getting them to work so looking for some help. Thank you in adcance!

Job #Shipment DateDue DateABCDXXXX
11/1/202312/2/2022AA121231234XXXX
21/1/202212/2/2021BB665577XXXX
31/1/202412/2/2023CC998824XXXX
410/1/20249/1/2024DD856874314XXXX
510/5/20209/5/2020EE101202303XXXX
69/9/20208/10/2020FF444555666XXXX
79/1/20248/2/2024GG888999110XXXX
811/1/202410/2/2024HH5687458742365XXXX
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Not sure if the columns will spill properly in Excel 2013, but this is a solution that uses older functions that should be available in that version (had to look at some of Mike Girvin's old videos to figure out how to do the aggregate/small/row thing):


Book3
ABCDEFGHIJKLMNOPQRSTUVW
1YearCount
220244
3Job #Shipment DateXXXXXXXXX
411/1/2023XXXXXXXXX31/1/2024XXXXXXXXX
521/1/2022XXXXXXXXX410/1/2024XXXXXXXXX
631/1/2024XXXXXXXXX79/1/2024XXXXXXXXX
7410/1/2024XXXXXXXXX811/1/2024XXXXXXXXX
8510/5/2020XXXXXXXXX 
969/9/2020XXXXXXXXX 
1079/1/2024XXXXXXXXX 
11811/1/2024XXXXXXXXX 
Sheet2
Cell Formulas
RangeFormula
N2N2=SUMPRODUCT(1*(YEAR(B4:B11)=M2))
M8:M11,M4:W7M4=IF(ROWS($M$4:M4)>$N$2,"",INDEX($A$4:$K$11,AGGREGATE(15,6,(ROW($A$4:$K$11)-ROW($A$4)+1)/(YEAR($B$4:$B$11)=$M$2),ROWS($M$4:M4)),0))
Dynamic array formulas.
 
Upvote 0
Fraid not, spill ranges only appeared in 2021.
Hmmm. Okay, here's an even more old-fashioned way. Hopefully this works in 2013:

Book3
ABCDEFGHIJKLMNOPQRSTUVW
1YearCountColumns
22024410
3Job #Shipment DateXXXXXXXXX
411/1/2023XXXXXXXXX31/1/2024XXXXXXXXX
521/1/2022XXXXXXXXX410/1/2024XXXXXXXXX
631/1/2024XXXXXXXXX79/1/2024XXXXXXXXX
7410/1/2024XXXXXXXXX811/1/2024XXXXXXXXX
8510/5/2020XXXXXXXXX           
969/9/2020XXXXXXXXX           
1079/1/2024XXXXXXXXX           
11811/1/2024XXXXXXXXX           
12           
Sheet2
Cell Formulas
RangeFormula
N2N2=SUMPRODUCT(1*(YEAR(B4:B11)=M2))
M4:W12M4=IF(COLUMNS(M$4:M4)>$O$2,"",IF(ROWS($M$4:M4)>$N$2,"",INDEX($A$4:$K$11,AGGREGATE(15,6,(ROW($A$4:$K$11)-ROW($A$4)+1)/(YEAR($B$4:$B$11)=$M$2),ROWS($M$4:M4)),COLUMNS($M4:M4))))
 
Upvote 0
Ok so this would require the user to drag down the formula based off the criteria that could fit? Guess I’ll just drag it down a large amount and pw protect it. I’ll test this out this week. Thanks for the help
 
Upvote 0
Ok so this would require the user to drag down the formula based off the criteria that could fit? Guess I’ll just drag it down a large amount and pw protect it. I’ll test this out this week. Thanks for the help
No problem!

Yes, you'd have to drag the formula down (in my example) to row 12, then to column W. Hope it works.
 
Upvote 0
I forgot we were dealing with 5k+ rows of data. I have a feeling the formula I posted could be really slow if you're dealing with large data, so, yes, you might want to consider VBA instead.
 
Upvote 0
Yeah that is what I was sort of alluding to wasn’t sure if it would bog it down I haven’t tried yet I won’t have access to the workstation until mid week anyways
 
Upvote 0
Here's a quick and dirty script. This filter the data on Sheet1 based on the year in M2. If there are rows that meet the criteria, it creates a new sheet and paste the data in A1.
VBA Code:
Sub FilterByYear()
    Dim filterYear As Long
    Dim ws As Worksheet, newSheet As Worksheet
    Dim lastRow As Long
    Dim rng As Range
    
    Set ws = ThisWorkbook.Worksheets("Sheet1")

    filterYear = ws.Range("M2").Value
    lastRow = ws.Cells(ws.Rows.Count, 2).End(xlUp).Row
    
    ws.Range("A3:K" & lastRow).AutoFilter Field:=2, _
        Criteria1:=">=" & DateSerial(filterYear, 1, 1), _
        Operator:=xlAnd, _
        Criteria2:="<=" & DateSerial(filterYear, 12, 31)
    
    ' Check if there are visible rows
    On Error Resume Next
    Set rng = ws.Range("A4:K" & lastRow).SpecialCells(xlCellTypeVisible)
    On Error GoTo 0
    
    If Not rng Is Nothing Then
        ' Create a new sheet
        Set newSheet = ThisWorkbook.Sheets.Add
        newSheet.Name = "FilteredData_" & filterYear
        
        ' Copy filtered cells to the new sheet
        ws.Rows(3).Copy Destination:=newSheet.Range("A1") ' Copy header
        rng.Copy Destination:=newSheet.Range("A2")        ' Copy filtered data
    Else
        MsgBox "No data found for the specified year.", vbExclamation
    End If
    
    ws.AutoFilterMode = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,763
Messages
6,180,826
Members
452,997
Latest member
gimamabe71

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