Solved

Date Formula: Last business day - 2 of prior month

Posted on 2016-10-19
12
30 Views
Last Modified: 2016-10-20
So I need two date formulas:

1. Calculate the third to last business day of the month (last business day - 2) of the PRIOR month.
2. Calculate the third to last business day of the month (last business day - 2) of the CURRENT month.
0
Comment
Question by:IO_Dork
  • 6
  • 5
12 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 41850746
Last Month
DateSerial(Year(CurrentDate), Month(CurrentDate), -2)

Open in new window


CurrentMonth
DateSerial(Year(CurrentDate), Month(CurrentDate)+1, -2)

Open in new window


mlmcc
0
 

Author Comment

by:IO_Dork
ID: 41850750
but does that handle just business days? or just any calendar day? Needs to calculate based on business days only.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 41851105
That is just calendar days.

I'll work on it for business days

mlmcc
0
 
LVL 34

Expert Comment

by:James0628
ID: 41851780
Is "business days" just Mon - Fri, or something else?  Are holidays a factor?

 Since you didn't specify, I'm guessing that it's just Mon - Fri, but I thought I'd check.

 James
0
 

Author Comment

by:IO_Dork
ID: 41851941
Correct, Just mon - fri.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 41851943
DO you have the last day of the month available or do you need to calculate that?

mlmcc
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:IO_Dork
ID: 41852024
Need to calculate that
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 41852070
Here is the basic formula for 3rd workday

WhilePrintingRecords;
If DayofWeek({Sheet2_.End Of Month}) in [1,2,3] then
    {Sheet2_.End Of Month} - 4
Else if DayofWeek({Sheet2_.End Of Month}) = 7 then
    {Sheet2_.End Of Month} - 3
Else
    {Sheet2_.End Of Month} - 2

Open in new window


mlmcc
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 41852086
Updated to calculate last day of month based on current date

Name - Last Day Of Current Month
WhilePrintingRecords;
Local DateVar LastDay;
LastDay := DateSerial(Year(CurrentDate), Month(CurrentDate) + 1, 0);
If DayofWeek(LastDay ) in [1,2,3] then
   LastDay  - 4
Else if DayofWeek(LastDay ) = 7 then
    LastDay - 3
Else
    LastDay  - 2

Open in new window


Name - Last Day Of PreviousMonth
WhilePrintingRecords;
Local DateVar LastDay;
LastDay := DateSerial(Year(CurrentDate), Month(CurrentDate), 0);
If DayofWeek(LastDay ) in [1,2,3] then
    LastDay  - 4
Else if DayofWeek(LastDay ) = 7 then
    LastDay  - 3
Else
   LastDay  - 2

Open in new window


mlmcc
0
 

Author Comment

by:IO_Dork
ID: 41852179
mlmcc:

So I am trying to reference this field in another formula field and I get the following error...will it not be possible to reference the result of this formula field? Ultimately, I need to reference this field to conditionally sum a different field.

screenshot.png
0
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 500 total points
ID: 41852217
Take the WhilePrintingRecords line out of the formulas

mlmcc
0
 

Author Closing Comment

by:IO_Dork
ID: 41852548
thanks, works perfectly!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now