Smart way to bin 8760 hourly data (series) based on several criteria?

OaklandJim

Well-known Member
Joined
Nov 29, 2018
Messages
833
Office Version
  1. 365
Platform
  1. 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.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi,

Seems first step should be to test the Frequency function:


Hope this will help
 
Upvote 0
sounds like you're after a sumifs or countifs formula - use the weekday formula with the second argument as 2 to get Saturday and Sunday as 6 & 7 (so the helper column for Weekend is just =IF(WEEKDAY(A2,2)>5,"Weekend","Weekday")
 
Upvote 0
Hi,

Seems first step should be to test the Frequency function:


Hope this will help

Cool that function but I need the sum (i.e., binning), not frequency of occurrence. Thnx tho.
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,626
Members
449,094
Latest member
bsb1122

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