Assign Month number 1 to n based on sequential week range

amolvijay

Board Regular
Joined
Nov 13, 2012
Messages
102
Office Version
  1. 365
Platform
  1. Windows
Hi Team,
Plz help me to automate the formula to compute month sequence...using formula.

For a intersection week, It should advance a month count if Preceding months days are less than succeeding month and vice versa it should remain same if preceding months days are greater than succeeding month days.

MonthM1M1M1M1M2M2M2M2M3M3M3M3M3M4M4M4M4M5M5M5M5M6M6M6M6M6
Week Start04-Mar11-Mar18-Mar25-Mar01-Apr08-Apr15-Apr22-Apr29-Apr06-May13-May20-May27-May03-Jun10-Jun17-Jun24-Jun01-Jul08-Jul15-Jul22-Jul29-Jul05-Aug12-Aug19-Aug26-Aug
Week End08-Mar15-Mar22-Mar29-Mar05-Apr12-Apr19-Apr26-Apr03-May10-May17-May24-May31-May07-Jun14-Jun21-Jun28-Jun05-Jul12-Jul19-Jul26-Jul02-Aug09-Aug16-Aug23-Aug30-Aug
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
What is wrong with what you have posted above? Or are you asking to create this with a formula?

Should the first Column "M3" be M3 or M4?

What determines the new month, the start of the week or any day in the week?

Here is something just based on the month number of either the start or end day of the week:
Book1
ABCDEFGHIJKLMNOPQRSTUVWXYZAA
1Month
2WeekStart2024-03-042024-03-112024-03-182024-03-252024-04-012024-04-082024-04-152024-04-222024-04-292024-05-062024-05-132024-05-202024-05-272024-06-032024-06-102024-06-172024-06-242024-07-012024-07-082024-07-152024-07-222024-07-292024-08-052024-08-122024-08-192024-08-26
3WeekEnd2024-03-082024-03-152024-03-222024-03-292024-04-052024-04-122024-04-192024-04-262024-05-032024-05-102024-05-172024-05-242024-05-312024-06-072024-06-142024-06-212024-06-282024-07-052024-07-122024-07-192024-07-262024-08-022024-08-092024-08-162024-08-232024-08-30
4
5Month based StartM1M1M1M1M2M2M2M2M2M3M3M3M3M4M4M4M4M5M5M5M5M5M6M6M6M6
6Month Based EndM1M1M1M1M2M2M2M2M3M3M3M3M3M4M4M4M4M5M5M5M5M6M6M6M6M6
Sheet4
Cell Formulas
RangeFormula
B2:AA2B2=SEQUENCE(,26,DATE(2024,3,4),7)
B3:AA3B3=SEQUENCE(,26,DATE(2024,3,8),7)
B5:AA6B5="M"&MONTH(B2)-2
Dynamic array formulas.
 
Last edited:
Upvote 0
Assuming your table starts in A1 i'd write 1 in B1 and in C1 (and copy to right) formula
Excel Formula:
=IF(MONTH(B3)<>MONTH(C3),B1+1,B1)
Then I'd select all cells in row 1 with 1 and with the formula, so may be something like B1:R1, or B1:Z1, or ... and format the cells with custom formatting:
"M"0
Note double quotation marks before and after M. They are necessary, otherwise excel will treat this formatting as a month number for 1900 Jan 01; 1900 Jan 02 and so on.
 
Upvote 0
@awoohaw - my understanding was that these are some dates on some shedule and dates in column B are first month of that task - doesn't matter if it's January, March or ... December.

But let's wait for @amolvijay reply
 
Upvote 0
@awoohaw - my understanding was that these are some dates on some shedule and dates in column B are first month of that task - doesn't matter if it's January, March or ... December.

But let's wait for @amolvijay reply
Thanks for the statement. My question about the M3 or M4 was for the column where the week transitions from April to May.
 
Upvote 0
Hmmm, @amolvijay was seen on the forum on Saturday, but not commented ...
@Kaper @awoohaw .. Apologize for delay in response.
I was desparately looking for the solution...and after two days of efforts finally I got the result..
Tomorrow I will paste the complicated formula currently working as per my requirement...
 
Upvote 0

Forum statistics

Threads
1,224,872
Messages
6,181,501
Members
453,047
Latest member
charlie_odd

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