Week number and year

ashleyfoozi

New Member
Joined
Mar 8, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi All

I have dates in a data set occuring from the beginning of 2021 and we are now in March 2022. Therefore if I use a formula to sum the data occuring in a week number it is going to add Jan 2021 and Jan 2022 together, which is not want I want to show. I only want to show the data from this year.
How can I determine if the week number has not yet occured in a year and must therefore be the previous years week number and must not be included.

Book1
ABCD
1DateWeekYearCount
22022/01/20320223
32022/01/20320221
42022/01/20320224
52021/12/084920215
62021/12/084920214
72021/12/084920211
82021/11/104520212
92021/11/104520213
102021/10/134120211
112021/10/134120212
122021/10/134120211
132021/09/083620212
142021/09/083620212
152021/09/083620212
162021/09/083620211
172021/09/083620213
182021/09/083620213
192021/09/083620211
202021/08/113220212
212021/08/113220211
222021/08/113220213
232021/08/113220213
242021/08/113220211
252021/07/072720211
262021/07/072720212
272021/07/072720211
282021/06/092320212
292021/06/092320212
302021/06/092320214
312021/06/092320213
322021/04/141520213
332021/04/141520214
342021/04/141520215
352021/03/111020214
362021/03/111020214
372021/03/111020213
Sheet1
Cell Formulas
RangeFormula
B2:B37B2=ISOWEEKNUM('Weet-Bix.xlsx'!Table_query__10[@Date])
C2:C37C2=YEAR('Weet-Bix.xlsx'!Table_query__10[@Date])


Cell Formulas
RangeFormula
A1A1=YEAR(TODAY())
B1B1=ISOWEEKNUM(TODAY()-77)
C1C1=ISOWEEKNUM(TODAY()-70)
D1D1=ISOWEEKNUM(TODAY()-63)
E1E1=ISOWEEKNUM(TODAY()-56)
F1F1=ISOWEEKNUM(TODAY()-49)
G1G1=ISOWEEKNUM(TODAY()-42)
H1H1=ISOWEEKNUM(TODAY()-35)
I1I1=ISOWEEKNUM(TODAY()-28)
J1J1=ISOWEEKNUM(TODAY()-21)
K1K1=ISOWEEKNUM(TODAY()-14)
L1L1=ISOWEEKNUM(TODAY()-7)
M1M1=ISOWEEKNUM(TODAY())
B2:M2B2=CHOOSE(MONTH(DATE($A$4,1,B1*7-2)-WEEKDAY(DATE(B1,1,3))),"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
B3:M3B3=CONCATENATE("WEEK"," ",B1)
B4:M13B4=SUMIFS(MMCount,MMWeek,B$4,MMNo,$A4)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
L3:M3Cell Value="OK"textNO
L3:M3Cell Value="ACTIVITY"textNO
B4:M13Cell Value="NYC"textNO
B4:M13Cell Value>0textNO
B4:M13Cell Value=0textNO


EDIT:
The data is added automatically to the data sheet from SharePoint and after naming my ranges the sheet is hidden. My customers used to want the data shown monthly, but now want to see it weekly as in Sheet 2. All formulas in sheet 2 are dynamic and the dates, weeks etc update automatically. The year must do the same.
If I can get the year into Sheet 2 B1, C1 etc then it would be easy to do a SUMIF matching the Week and Year in Sheet 1. As you can see in Sheet 2 the week 51 occured last year 2021, so if I were to add a row at Row 1 and show the years then B1 should be 2021and B2 week 51, C1 should be Year 2021 and C2 week 52, D1 Year 2022 and D2 Week 1 etc.
 

Attachments

  • 1646731635224.png
    1646731635224.png
    24.1 KB · Views: 7
  • 1646731670115.png
    1646731670115.png
    15.4 KB · Views: 7
  • 1646731750969.png
    1646731750969.png
    24.4 KB · Views: 7
Last edited by a moderator:

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Upvote 0

Forum statistics

Threads
1,216,126
Messages
6,129,021
Members
449,480
Latest member
yesitisasport

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