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
377
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. :)
 
T202401a.xlsm
ABCDE
1Start DateEnd Dateedit First April Monday in Year 2023 if B2 empty or from B2 date
211-Nov-2204-Apr-2203-Apr-23Should be 03/04/2023
311-Nov-2202-Jan-2404-Apr-2203-Apr-23Should be 03/04/2023
411-Nov-2206-Apr-2404-Apr-2201-Apr-24Should be 01/04/2024
510-Oct-2105-Apr-2103-Apr-23Should be 03/04/2023
610-Oct-2111-Oct-2105-Apr-2105-Apr-21Should be 05/04/2021
710-Oct-2105-Apr-2205-Apr-2104-Apr-22Should be 04/04/2022
810-Oct-2110-Oct-2305-Apr-2103-Apr-23Should be 03/04/2023
9
1bbb
Cell Formulas
RangeFormula
C2:C8C2=LET(yc,DATE(YEAR(A2),4,0),yp,DATE(YEAR(A2)-1,4,0),IF(A2<=yc,WORKDAY.INTL(yp,1,"0111111"),WORKDAY.INTL(yc,1,"0111111")))
D2:D8D2=LET(yc,DATE(2023,4,0),yx,DATE(YEAR(B2),4,0),yp,DATE(YEAR(B2)-1,4,0),IF(B2<1,WORKDAY.INTL(yc,1,"0111111"),IF(MONTH(B2)<4,WORKDAY.INTL(yp,1,"0111111"),WORKDAY.INTL(yx,1,"0111111"))))


I edited your definition for Column D to secure the results that you show.
Please review the logic and ensure the logic is consistent with your requirements.
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Oh my, Dave! Again, totally in awe and appreciative for your help. I should have known to change TODAY() in column C :rolleyes:, but formula in D2 is perfect and works a dream.

Really couldn't have done this without you, so, huge thanks again 😁
 
Upvote 0
Dave, I'm so sorry - it doesn't seem to be working when April dates are entered which are on the cusp of the new fiscal year (first Monday in April):
MrExcel Queries.xlsm
ABCDEF
1Start DateEnd DateDave's Formula Fiscal Year Start Date (first Monday in April)Dave's Formula Fiscal Year End Date (first Monday in April)Fiscal Year Start Date (first Monday in April)Fiscal Year End Date (first Monday in April)
202/04/202303/04/202303/04/2023Should be 04/04/2022Should be 03/04/2023
303/04/202204/04/202203/04/2023Should be 05/04/2021Should be 03/04/2023
403/04/202204/04/202204/04/202204/04/2022Should be 05/04/2021Should be 04/04/2022
502/04/202204/04/202203/04/2023Should be 05/04/2021Should be 03/04/2023
602/04/202203/04/202204/04/202204/04/2022Should be 05/04/2021Should be 05/04/2021
702/04/202203/04/202304/04/202203/04/2023Should be 01/04/2024Should be 03/04/2023
801/04/202507/04/202503/04/2023Should be 01/04/2024Should be 03/04/2023
901/04/202508/04/202507/04/202507/04/2025Should be 01/04/2024Should be 08/04/2025
Sheet3
Cell Formulas
RangeFormula
C2:C9C2=LET(yc,DATE(YEAR(A2),4,0),yp,DATE(YEAR(A2)-1,4,0),IF(A2<=yc,WORKDAY.INTL(yp,1,"0111111"),WORKDAY.INTL(yc,1,"0111111")))
D2:D9D2=LET(yc,DATE(2023,4,0),yx,DATE(YEAR(B2),4,0),yp,DATE(YEAR(B2)-1,4,0),IF(B2<1,WORKDAY.INTL(yc,1,"0111111"),IF(MONTH(B2)<4,WORKDAY.INTL(yp,1,"0111111"),WORKDAY.INTL(yx,1,"0111111"))))
Cells with Data Validation
CellAllowCriteria
A1:F9Any value

This will be the bane of one's week, eh! ;)
 
Upvote 0
What part of the criteria or formula changed?
Is the problem with just Apr 1 Apr 2 and Apr 3? The fiscal year may start on different days each year.
Where is the problem with the formula? Did you review with Formula Evaluate?
 
Last edited:
Upvote 0
Please test the following for the first column.
If it is OK, I will look at the second column.

T202401a.xlsm
ABC
1Start DateEnd DateDave's Formula Fiscal Year Start Date (first Monday in April)
202-Apr-2304-Apr-22
303-Apr-2205-Apr-21
403-Apr-2204-Apr-2205-Apr-21
502-Apr-2205-Apr-21
602-Apr-2203-Apr-2205-Apr-21
702-Apr-2203-Apr-2305-Apr-21
801-Apr-2501-Apr-24
901-Apr-2508-Apr-2501-Apr-24
1b_4
Cell Formulas
RangeFormula
C2:C9C2=LET(yc,WORKDAY.INTL(DATE(YEAR(A2),4,0),1,"0111111"),yp,WORKDAY.INTL(DATE(YEAR(A2)-1,4,0),1,"0111111"),IF(A2<=yc,yp,yc))
 
Upvote 0
Yes, the problem is with the first few days of April if they fall before a Monday and, therefore, they will be in the previous fiscal year. So, the fiscal date will actually be different each year.

I have evaluated the formula, which is not something I do often, so excuse my inexperience, but could it be this bit?
1704740580159.png
 
Upvote 0
Sorry, our messages crossed - just checking your formula now...
 
Upvote 0
I've been trying to amend the second formula (column D), but with no joy 😆, so, shall wait to hear from you. Thanks everso, Dave!
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

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