Week number for a particular month not working for the month of January

ExcelNewbie2020

Active Member
Joined
Dec 3, 2020
Messages
343
Office Version
  1. 365
Platform
  1. Windows
Sirs,

I have a formula that counts the week number of a particular month (from week 1 to week 5). It is working properly from february 2023 onwards but its not working for January 2023. Please check how to make it work.. many thanks


testing.xlsx
ABCD
1Current Fomula ResultExpected Result
227-01-23-474
328-01-23-474
429-01-23-474
530-01-23-465
631-01-23-465
701-02-2311
802-02-2311
903-02-2311
1004-02-2311
1105-02-2311
1206-02-2322
1307-02-2322
1408-02-2322
1509-02-2322
1610-02-2322
1711-02-2322
1812-02-2322
Sheet17
Cell Formulas
RangeFormula
C2:C18C2=ISOWEEKNUM(A2)-ISOWEEKNUM(DATE(YEAR(A2),MONTH(A2),1))+1
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Power Query Solution

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type date}}),
    #"Inserted Week of Month" = Table.AddColumn(#"Changed Type", "Week of Month", each Date.WeekOfMonth([Column1]), Int64.Type)
in
    #"Inserted Week of Month"

Column1Week of Month
1/27/20234
1/28/20234
1/29/20235
1/30/20235
1/31/20235
2/1/20231
2/2/20231
2/3/20231
2/4/20231
2/5/20232
2/6/20232
2/7/20232
2/8/20232
2/9/20232
2/10/20232
2/11/20232
2/12/20233
 
Upvote 0
Power Query Solution

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type date}}),
    #"Inserted Week of Month" = Table.AddColumn(#"Changed Type", "Week of Month", each Date.WeekOfMonth([Column1]), Int64.Type)
in
    #"Inserted Week of Month"

Column1Week of Month
1/27/20234
1/28/20234
1/29/20235
1/30/20235
1/31/20235
2/1/20231
2/2/20231
2/3/20231
2/4/20231
2/5/20232
2/6/20232
2/7/20232
2/8/20232
2/9/20232
2/10/20232
2/11/20232
2/12/20233
thanks man, as much as possible, i am hoping on a excel formula..
 
Upvote 0
Or try this:

=IF(MONTH(A2)=1;ISOWEEKNUM(A2); ISOWEEKNUM(A2)-ISOWEEKNUM(EOMONTH (A2;-1)+1)+1)
 
Upvote 0
Or try this:

=IF(MONTH(A2)=1;ISOWEEKNUM(A2); ISOWEEKNUM(A2)-ISOWEEKNUM(EOMONTH (A2;-1)+1)+1)
thanks man. but it's error..
 

Attachments

  • 1676626776178.png
    1676626776178.png
    35.3 KB · Views: 5
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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