Return first Monday in April from one date and first Monday in current year April if another is blank

SaraWitch

Active Member
Joined
Sep 29, 2015
Messages
370
Office Version
  1. 365
Platform
  1. Windows
Hello peeps,

I call upon your expertise again!

I have a start date in A2 and an end date in B2. I want a formula in C2 to return the first Monday in April before the A2 date. I also want a formula in D2 (E2 from example below) to return the date of the first Monday in April of the current year if no date is entered in B2 but to return the date in B2 if one is entered.

For example:
Auto move row.xlsm
ABCDE
1Start DateEnd DateFirst Monday in April before Start DateI can get first Monday in month, but not April'sFirst April Monday in Current Year if B2 empty or B2 date
211/11/2023Should be 03/04/202306/11/2023Should be 03/04/2023
310/10/2021Should be 05/04/202104/10/2021Should be 03/04/2023
403/01/2024Should be 03/04/202301/01/2024Should be 03/04/2023
512/12/202210/10/2023Should be 04/04/202205/12/2022Should be 10/10/2023
604/04/2022Should be 04/04/202204/04/2022Should be 03/04/2023
703/04/2022Should be 05/04/202104/04/2022Should be 03/04/2023
802/02/202304/04/2023Should be 03/04/202306/02/2023Should be 04/04/2023
929/09/202203/01/2024Should be 04/04/202205/09/2022Should be 03/01/2024
1029/09/2022Should be 04/04/202205/09/2022Should be 03/04/2023
Sheet3
Cell Formulas
RangeFormula
D2:D10D2=IF(A2=0,"",A2-DAY(A2)+8-WEEKDAY(A2-DAY(A2)+6))
Cells with Data Validation
CellAllowCriteria
A1:E10Any value


I can return the first Monday of a date's month (column D), but not April's. I've also tried breaking down the dates into years first, but I'm ending up with more columns than I feel I need.

Any help would be gratefully received. :)
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
T202401a.xlsm
ABCDEF
1Start DateEnd DateFirst Monday in Start MonthFirst April Monday in 2023 First April Monday in Applicable Year
211-Nov-23Mon 06-Nov-23Mon 03-Apr-23Mon 01-Apr-24
310-Oct-21Mon 04-Oct-21Mon 03-Apr-23Mon 01-Apr-24
403-Jan-24Mon 01-Jan-24Mon 03-Apr-23Mon 01-Apr-24
512-Dec-2210-Oct-23Mon 05-Dec-22Mon 03-Apr-23Mon 03-Apr-23
604-Apr-22Mon 04-Apr-22Mon 03-Apr-23Mon 01-Apr-24
703-Apr-22Mon 04-Apr-22Mon 03-Apr-23Mon 01-Apr-24
802-Feb-2304-Apr-23Mon 06-Feb-23Mon 03-Apr-23Mon 03-Apr-23
929-Sep-2203-Jan-24Mon 05-Sep-22Mon 03-Apr-23Mon 01-Apr-24
1029-Sep-22Mon 05-Sep-22Mon 03-Apr-23Mon 01-Apr-24
11
1b
Cell Formulas
RangeFormula
D2:D10D2=WORKDAY.INTL(A2-DAY(A2),1,"0111111")
E2:E10E2=WORKDAY.INTL(DATE(2023,4,0),1,"0111111")
F2:F10F2=WORKDAY.INTL(DATE(IF(B2,YEAR(B2),YEAR(TODAY())),4,0),1,"0111111")
 
Upvote 0
Thank you, Dave. This isn't quite what I need though.

For column C (your column E), I need the first Monday in the April before the start date in column A.

For column E (your column F), if there's no date in column B, I need the first Monday in this fiscal year's April (so for January to March 2024 dates, it needs to be 03/04/2023 (sorry, I didn't make this clear in original post)); otherwise, the date in column B.

I've put what the dates should be in my first example, but here's another for dates in January-April 2024:
MrExcel Queries.xlsm
ABCDE
1Start DateEnd DateFirst Monday in April before Start DateI can get first Monday in month, but not April'sFirst April Monday in Current Year if B2 empty or B2 date
203/01/2024Should be 03/04/202301/01/2024Should be 03/04/2023
304/02/2024Should be 03/04/202305/02/2024Should be 03/04/2023
431/03/2024Should be 03/04/202304/03/2024Should be 03/04/2023
510/02/202412/02/2024Should be 03/04/202305/02/2024Should be 12/02/2023
601/04/2024Should be 01/04/202401/04/2024Should be 01/04/2024
710/04/2024Should be 01/04/202401/04/2024Should be 01/04/2024
812/04/202414/04/2024Should be 01/04/202401/04/2024Should be 14/04/2024
Sheet3
Cell Formulas
RangeFormula
D2:D8D2=IF(A2=0,"",A2-DAY(A2)+8-WEEKDAY(A2-DAY(A2)+6))
Cells with Data Validation
CellAllowCriteria
A1:E8Any value

Not sure if this can be done...?
 
Upvote 0
T202401a.xlsm
ABCD
1Start DateEnd Date
203-Jan-2403-Apr-2303-Apr-23
304-Feb-2403-Apr-2303-Apr-23
431-Mar-2403-Apr-2303-Apr-23
510-Feb-2412-Feb-2403-Apr-2303-Apr-23
601-Apr-2401-Apr-2401-Apr-24
710-Apr-2401-Apr-2401-Apr-24
812-Apr-2414-Apr-2401-Apr-2401-Apr-24
1bb
Cell Formulas
RangeFormula
C2:C8C2=LET(yc,DATE(YEAR(TODAY()),4,0),yp,DATE(YEAR(TODAY())-1,4,0),IF(A2<=yc,WORKDAY.INTL(yp,1,"0111111"),WORKDAY.INTL(yc,1,"0111111")))
D2:D8D2=LET(yc,DATE(YEAR(TODAY()),4,0),yp,DATE(YEAR(TODAY())-1,4,0),IF(OR(B2>"",A2<=yc),WORKDAY.INTL(yp,1,"0111111"),WORKDAY.INTL(yc,1,"0111111")))
 
Upvote 0
For column E (your column F), if there's no date in column B, I need the first Monday in this fiscal year's April (so for January to March 2024 dates, it needs to be 03/04/2023 (sorry, I didn't make this clear in original post)); otherwise, the date in column B.
When you say "this fiscal year", do you mean the fiscal year of the date in columna A or the fiscal year of the current date (as in TODAY())?

And what is your fiscal year? There are many different ones depending on country, state:

Fiscal year - Wikipedia
 
Upvote 0
Wow! Thank you so much, Dave - this works a treat!

I just tweaked the D2 formula to:
Excel Formula:
=IF(B2=0,LET(yc,DATE(YEAR(TODAY()),4,0),yp,DATE(YEAR(TODAY())-1,4,0),IF(OR(B2>"",A2<=yc),WORKDAY.INTL(yp,1,"0111111"),WORKDAY.INTL(yc,1,"0111111"))),B2)

Thank you! 😊


When you say "this fiscal year", do you mean the fiscal year of the date in columna A or the fiscal year of the current date (as in TODAY())?

And what is your fiscal year? There are many different ones depending on country, state
Yes, sorry @felixstraube, I know fiscal years differ from county to country, and even organisations, but in this case the new fiscal year starts on the first Monday in April. I was considering VLOOKUP, but Dave's formulas have worked perfectly 😊
 
Upvote 0
The formula in column C is the fiscal date of the date in column A and the formula in column D is the date in column B unless empty, in which case it is the fiscal date of the current (TODAY()) date. So, as I said, Dave's formulas work perfectly. 😊
 
Upvote 0
It does, thank you, Dave.

However... ...as I've started to use this, it's not working for dates pre-2023 (e.g., row 3 in my original post and below examples). I've also realised that the second formula (in column D below) needs to return this fiscal year's first April Monday if B is blank (which is does, brilliant), but then if a date is entered in B, I need the first April Monday before that date (not the actual date in B (sorry, my mistake before, but the formula is a handy one!)):
MrExcel Queries.xlsm
ABCDEF
1Start DateEnd DateDave's formula for First Monday in April before Start Date (see column E)Dave's formula for First April Monday in Current Year if B2 empty or from B2 date (see column F)First Monday in April before Start DateFirst April Monday in Current Year if B2 empty or from B2 date
211/11/202203/04/202303/04/2023Should be 04/04/2022Should be 03/04/2023
311/11/202202/01/202403/04/202303/04/2023Should be 04/04/2022Should be 03/04/2023
411/11/202206/04/202403/04/202303/04/2023Should be 04/04/2022Should be 01/04/2024
510/10/202103/04/202303/04/2023Should be 05/04/2021Should be 03/04/2023
610/10/202111/10/202103/04/202303/04/2023Should be 05/04/2021Should be 05/04/2021
710/10/202105/04/202203/04/202303/04/2023Should be 05/04/2021Should be 04/04/2022
810/10/202110/10/202303/04/202303/04/2023Should be 05/04/2021Should be 03/04/2023
Sheet3
Cell Formulas
RangeFormula
C2:C8C2=LET(yc,DATE(YEAR(TODAY()),4,0),yp,DATE(YEAR(TODAY())-1,4,0),IF(A2<=yc,WORKDAY.INTL(yp,1,"0111111"),WORKDAY.INTL(yc,1,"0111111")))
D2:D8D2=LET(yc,DATE(YEAR(TODAY()),4,0),yp,DATE(YEAR(TODAY())-1,4,0),IF(OR(B2>"",A2<=yc),WORKDAY.INTL(yp,1,"0111111"),WORKDAY.INTL(yc,1,"0111111")))
Cells with Data Validation
CellAllowCriteria
A1:F8Any value
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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