To check if Last working day of month was a Friday.

rollingzep

Board Regular
Joined
Nov 18, 2013
Messages
214
Office Version
  1. 365
Platform
  1. Windows
Hi All,

In my Excel App, for our monthly report, I need to set the value of a column based on a date column (B).
If the dates in col B are the last working day of the month and happens to be a Friday then values in col BA should 3.
For example, in Col B, the dates are 03/31/03 and is a Friday, how to derive the value.

Since April 28 will also be the last working day and Friday, i need to get this .
How to determine if the last working day is a Friday or not?

TIA
 
Here is excel formulas:
Book1
ABA
1
2Sat, 2023-02-25 
3Sun, 2023-02-26 
4Mon, 2023-02-27 
5Tue, 2023-02-28 
6Wed, 2023-03-01 
7Thu, 2023-03-02 
8Fri, 2023-03-03 
9Mon, 2023-03-27 
10Tue, 2023-03-28 
11Wed, 2023-03-29 
12Thu, 2023-03-30 
13Fri, 2023-03-313
14Sat, 2023-04-01 
15Sun, 2023-04-02 
16Wed, 2023-04-26 
17Thu, 2023-04-27 
18Fri, 2023-04-283
19Sat, 2023-04-29 
20Sun, 2023-04-30 
21Mon, 2023-05-01 
22Tue, 2023-05-02 
Sheet1
Cell Formulas
RangeFormula
BA2:BA22BA2=IF(AND(WEEKDAY(A2)=6,DAY(WORKDAY.INTL(A2,1))<=3),3,"")

This does not take holidays into consideration. What will you do when Friday is within 3 days of the last day of the month and it is a Holiday?
Does the Thursday then mean that BA becomes a 3? Holiday table can easily be incorporated into the WORKDAY.INTL function.
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
I mentioned that you need to specify the starting day of the week?
Without the second parameter, it default to Sunday. That is why I said check the syntax :(

I mentioned that you need to specify the starting day of the week?
Without the second parameter, it default to Sunday. That is why I said check the syntax :(
I have just the date in Col B and no second parameter. Or I am not getting you.
1680796256334.png
 
Upvote 0
Have you tried what I suggested?
 
Upvote 1
Solution
@rollingzep, did you look at Posts 10 & 11? I'm not sure if you're seeking a VBA or Excel Worksheet Formula solution.
 
Upvote 0
Judging by th fact the OP has posted code, I suspect a VBA solution. ;)
 
Upvote 0
@rollingzep, did you look at Posts 10 & 11? I'm not sure if youre seeking a VBA or Excel Worksheet Formula solution.

Judging by th fact the OP has posted code, I suspect a VBA solution. ;)
I did not read that as part of the intial requirements. Sometimes people overthink things (I am a perpetrator in this regard as well).
But, as to your solution, how does your formula check to see that it is the last day of the month? Or is that something else I missed?

subsequent edit: Last business day of the month.
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,369
Members
449,080
Latest member
Armadillos

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