SORT DATE INTO WEEK

Unlucky

Board Regular
Joined
Dec 3, 2014
Messages
58
Office Version
  1. 2016
Platform
  1. Windows
I reviewed previous posts for determining weeks by date, but instead of a running count of months, I separated each month into 5 weeks Specifically,

Day 1 thru 7 is Week 1
Day 8 thru 14 is Week 2
Day 15 thru 21 is Week 3
Day 22 thru 28 is Week 4
Day 29 thru 31 is Week 5

It is understood that some months have only 30 days (and at most February on has 29.

Bottom Line:
I need to sort the data by month and then week, and then by program. The breakout is necessary for monthly product sales and determining which week has a peak in sales. Here is the rough draft table I'm working on.

AUDIT METRICS.xlsx
BCDEFGHIJKLMN
8PROGRAM AUDIT METRICS (INITIAL, RECHECK, ETC.)PROGRAM AUDIT METRICS (INITIAL, RECHECK, ETC.)
9
10AWEEKWEEKWEEKWEEKWEEKBWEEKWEEKWEEKWEEKWEEK
111234512345
12JAN00000JAN00000
13FEB00000FEB00000
14MAR00000MAR00000
15APR00000APR00000
16MAY00000MAY00000
17JUN00000JUN00000
18JUL00000JUL00000
19AUG00000AUG00000
20SEP00000SEP00000
21OCT00000OCT00000
22NOV00000NOV00000
23DEC00000DEC00000
24TOTAL00000TOTAL00000
25AVERAGE0.000.000.000.000.00AVERAGE0.000.000.000.000.00
26
27
28DATEWEEKWEEK No.PROGRAMSTART DATEEND DATEWK 1 STARTWK 2 STARTWK 3 STARTWK 4 STARTWK 5 START
297-Jan-202112A1-Jan-202131-Jan-20211-Jan-20218-Jan-202115-Jan-202122-Jan-202129-Jan-2021
308-Jan-202122A1-Feb-202128-Feb-20211-Feb-20218-Feb-202115-Feb-202122-Feb-2021
318-Jan-202122A1-Mar-202131-Mar-20211-Mar-20218-Mar-202115-Mar-202122-Mar-202129-Mar-2021
329-Jan-202122A1-Apr-202130-Apr-20211-Apr-20218-Apr-202115-Apr-202122-Apr-202129-Apr-2021
3312-Jan-202123A1-May-202131-May-20211-May-20218-May-202115-May-202122-May-202129-May-2021
3412-Jan-202123B1-Jun-202130-Jun-20211-Jun-20218-Jun-202115-Jun-202122-Jun-202129-Jun-2021
3512-Jan-202123A1-Jul-202131-Jul-20211-Jul-20218-Jul-202115-Jul-202122-Jul-202129-Jul-2021
3612-Jan-202123B1-Aug-20211-Aug-20211-Aug-20218-Aug-202115-Aug-202122-Aug-202129-Aug-2021
3715-Jan-202133B1-Sep-202130-Sep-20211-Sep-20218-Sep-202115-Sep-202122-Sep-202129-Sep-2021
3816-Jan-202133B1-Oct-202131-Oct-20211-Oct-20218-Oct-202115-Oct-202122-Oct-202129-Oct-2021
3930-Jan-202155A1-Nov-202130-Nov-20211-Nov-20218-Nov-202115-Nov-202122-Nov-202129-Nov-2021
4030-Jan-202155A1-Dec-202131-Dec-20211-Dec-20218-Dec-202115-Dec-202122-Dec-202129-Dec-2021
4131-Jan-202156B
423-Feb-202116AMONTHLY BREAKDOWN
433-Feb-202116BWEEK 1WEEK 2WEEK 3WEEK 4WEEK 5
443-Feb-202116B1-78-1415-2122-2829-31
456-Feb-202116B
467-Feb-202117B
477-Feb-202117B
4819-Feb-202138B
4920-Feb-202138B
5020-Feb-202138B
5121-Feb-202139B
5222-Feb-202149A
5328-Feb-2021410A
5428-Feb-2021410A
5528-Feb-2021410A
5628-Feb-2021410B
5728-Feb-2021410A
581-May-2021118B
593-Mar-2021110B
604-Mar-2021110B
614-Mar-2021110B
626-Mar-2021110A
637-Mar-2021111A
647-Mar-2021111A
658-Mar-2021211B
669-Mar-2021211A
6710-Mar-2021211B
6810-Mar-2021211A
6910-Mar-2021211B
7011-Mar-2021211A
7112-Mar-2021211B
7216-Mar-2021312B
7317-Mar-2021312B
7421-Mar-2021313A
7521-Mar-2021313A
7626-Mar-2021413A
7726-Mar-2021413B
7831-Mar-2021514A
FORMULA TEST
Cell Formulas
RangeFormula
J24:N24,C24:G24C24=SUM(C12:C23)
J25:N25,C25:G25C25=AVERAGEIF(C12:C23,">=0")
D29:D78D29=WEEKNUM(B29,1)
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
for month, use formula =Month() & pull from column A; [ use month function]
for week,
Excel Formula:
=IF(DAY(A1)<8,1,IF(DAY(A1)<15,2,IF(DAY(A1)<22,3,IF(DAY(A1)<29,4,IF(DAY(A1)<32,5,"Error")))))
this will give a week number. [use day function]
I would then put this info into a Pivot table to summarize and standardize the layout.
let me know if this helps you, or gets you going in the right direction?
 
Upvote 0
When I entered the formula, in cells D29:D78 it reported 1 in every cell. I got the same result for C29:C78. Same result if I use the Ctrl+Shift+Enter.
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

How about
Excel Formula:
=INT((DAY(B29)-1)/7)+1
 
Upvote 0
Solution
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

How about
Excel Formula:
=INT((DAY(B29)-1)/7)+1
I apologize. I updated my profile to include Excel 2016.
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

How about
Excel Formula:
=INT((DAY(B29)-1)/7)+1
This worked like a charm. Thank you!
 
Upvote 0
When I entered the formula, in cells D29:D78 it reported 1 in every cell. I got the same result for C29:C78. Same result if I use the Ctrl+Shift+Enter.
if you mean on my version, change A1 to be the same row as where your putting in formula. EX if in row 12, change all the 'A1' to 'A12'.
 
Upvote 0
@queuesmef what's in col A?
I actually use a separate spreadsheet to test formulas and make sure they work prior to incorporating them into the main workbook. I figured out what the problem was . . . . . I use the $ in the wrong place when I dragged the cells to complete the table. No worries, its all good now. Thanks again!
 
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,839
Members
449,051
Latest member
excelquestion515

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