LAST BUSINESS DAY OF MONTH?

daveyc18

Well-known Member
Joined
Feb 11, 2013
Messages
707
Office Version
  1. 365
  2. 2010
=WORKDAY(EOMONTH(report_date,-1),-1, holidays) YIELDS .. "APRIL 28, 2023" because the report_date is 5/1/2023

but if i apply that same formula for 2 month ago

=WORKDAY(EOMONTH(report_date,-2),-1, holidays) , im getting "March 30,2023," but I want March 31, 2023

what am i doing wrong here?


if i change it to "=WORKDAY(EOMONTH(report_date,-2),0, holidays)", then I get "March 31, 2023" , but obviously changing the formula depending on the month is not the ideal solution
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
you are using the EOMONTH function so you're starting date for workday.intl is 3/31. You need to Add 1 to it to get the work day prior.
 
Upvote 0
here it is in action:
Cell Formulas
RangeFormula
B1:H1B1=EOMONTH(A1,0)+1
A2:H2,A6:H6A2=WEEKDAY(A1,2)
A3:H3,A7:H7A3=A1
A5:H5A5=WORKDAY.INTL(A1,-1,1)
B10B10=WORKDAY.INTL($B9,-1,1)
B11B11=WORKDAY.INTL(EOMONTH(B9,-2)+1,-1,1)
 
Upvote 0
you are using the EOMONTH function so you're starting date for workday.intl is 3/31. You need to Add 1 to it to get the work day prior.

sorry not on my PC rn but would that not mess up my first formula that correctly picks up April 28?
 
Upvote 0
sorry not on my PC rn but would that not mess up my first formula that correctly picks up April 28?
not at all... because you have two different formulas already.

But, I'll post single formula in a minute.
 
Upvote 0
Here is formula that, I think, yields what you want:


Book4
ABCD
1Report Day:2023-05-01
2
3Desired Report EO MonthHow many Months ago
4Last BD 1 MnthApril12023-04-28
5Last BD 2 MnthMarch22023-03-31
Sheet9
Cell Formulas
RangeFormula
D4:D5D4=WORKDAY.INTL(EOMONTH($B$1,-$C4)+1,-1,1)
 
Upvote 0
would that not mess up my first formula that correctly picks up April 28?
No because 30th Apr is a Sunday, whereas 31st Mar is a Friday. Your formula will only work correctly if the last day of the month is a Saturday or Sunday.
As has been said, you need to add one to the end of the month so that your date is the 1st of the next month.
Excel Formula:
=WORKDAY(EOMONTH(report_date,-2)+1,-1, holidays)
 
Upvote 0

Forum statistics

Threads
1,215,193
Messages
6,123,560
Members
449,108
Latest member
rache47

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