I'm trying to convert an Excel spreadsheet into Google Sheets. I have the entire year on a sheet and would like to filter the list based on a selected month from a dropdown. For example, selecting "June" would filter the page to only show June 1 through June 30.
Google Drive link: Google Sheets
OneDrive link: Excel Spreadsheet
I'm thinking I need to set the data validation of the dropdown to point to a secondary sheet and use a filter function to select dates with a position number corresponding to the month number (i.e. 1- January, 2-February, etc); but for some reason, my filter function returns an error message even if I attempt sorting by a manually entered date range ; (i.e.) date>=(2015,1,1), date<=(2015,1,31).
Edit: I just realized that OneDrive does not work with the VBA code. I'll attach it to this post:
Private Sub ComboBox1_Change() '2015 Sheet Dim FromDate As Integer Dim EndDate As Integer Dim YearPortion As String Dim NextYear As String YearPortion1 = "-01-2015" YearPortion2 = "-01-2015" FromDate = ComboBox1.ListIndex + 1 EndDate = ComboBox1.ListIndex + 2 If EndDate = 13 Then YearPortion2 = "-01-2016" If EndDate = 13 Then EndDate = 1 Sheet4.Cells(7, 1).CurrentRegion.Columns(1).AutoFilter 1, ">=" & Format(FromDate, "00") & YearPortion1, xlAnd, "<" & Format(EndDate, "00") & YearPortion2 End Sub