OaklandJim
Well-known Member
- Joined
- Nov 29, 2018
- Messages
- 833
- Office Version
- 365
- Platform
- Windows
Have a series of 8760 data values. Data includes adjacent dates and times columns too. Want to bin based on date and time and whether weekday or weekend. . E.g. all values between two certain dates, between two hours per day and weekday or weekend.
Have a separate sheet with all inputs regarding dates and times.
Wuz about to embark on a VBA odyssey to write a sub that does the binning. I bet that there is a better way? I like sumproduct but that may be too ugly given all the inputs. I'm a low-power pivot tabler but maybe that? Maybe old fashioned Excel criteria "table" (I have totally forgotten how to do that)?
Details
For any one one bin it is for one each of the following criteria: five time periods, two "seasons" (specified by start and end date) and whether weekday or weekend so I think I need a formula of some sort to calculate all bins at once.
I have several named data ranges of series data (8760 one row each). The one with data to bin is named SeriesValues. Other 8760 series values -- whose data criterion should be self-obvious given names -- that can be used to help include: Series_DayOfYear (integers 1 - 365), Series_HourOfDay (integers 1- 24), Series_DayOfWeek (integers 1- 7), SeriesDates, SeriesTimes.
I have other named cells with the "screening" criteria/values needed: StartDate, EndDate, StartTime, EndTime.
So for values in range SeriesValues I want to sum and in them based on five criteria: : StartDate, EndDate, StartTime, EndTime and whether weekend or weekday.
Aside: based on what I see using Excel's weekday formula that weekend days of week are #7 -- Saturday and #1 -- Sunday.
Have a separate sheet with all inputs regarding dates and times.
Wuz about to embark on a VBA odyssey to write a sub that does the binning. I bet that there is a better way? I like sumproduct but that may be too ugly given all the inputs. I'm a low-power pivot tabler but maybe that? Maybe old fashioned Excel criteria "table" (I have totally forgotten how to do that)?
Details
For any one one bin it is for one each of the following criteria: five time periods, two "seasons" (specified by start and end date) and whether weekday or weekend so I think I need a formula of some sort to calculate all bins at once.
I have several named data ranges of series data (8760 one row each). The one with data to bin is named SeriesValues. Other 8760 series values -- whose data criterion should be self-obvious given names -- that can be used to help include: Series_DayOfYear (integers 1 - 365), Series_HourOfDay (integers 1- 24), Series_DayOfWeek (integers 1- 7), SeriesDates, SeriesTimes.
I have other named cells with the "screening" criteria/values needed: StartDate, EndDate, StartTime, EndTime.
So for values in range SeriesValues I want to sum and in them based on five criteria: : StartDate, EndDate, StartTime, EndTime and whether weekend or weekday.
Aside: based on what I see using Excel's weekday formula that weekend days of week are #7 -- Saturday and #1 -- Sunday.