- Read the excel sheet with the readtable function.
- Create data group ranges for your rows.
- Create logical indices for each Dwt group.
- Filter the data for each dwt group.
- Calculate the counts for each group and time period as you want.
- Assign the row names and column names as required.