• Prabhata Rath
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi Guys,

I have a requirement like we have to calculate current working day (e.g. 4th or 5th working day) excluding WEEKENDS and PUBLIC HOLIDAYS. For excluding weekends, there is a formula. But for excluding public holidays ,I am not sure how to write a formula for the same.

Currently to calculate current business day excluding weekends, I am using the formula (retrieved from Salesforce Help) given below:
( 
( FLOOR ( ( TODAY() - DATE (1900,01,01) ) / 7 ) *5 ) 
+ MIN ( 5, MOD ( TODAY() - DATE (1900,01,01), 7 ) +1 ) 
) - 
( 
( FLOOR ( ( DATE(YEAR(TODAY()),MONTH(TODAY()),1) - DATE (1900,01,01) ) / 7 ) *5 ) 
+ MIN ( 5, MOD ( DATE(YEAR(TODAY()),MONTH(TODAY()),1) - DATE (1900,01,01), 7 ) ) 
)
So now, I request for the possible solutions (both Configuration and customization way). Configuration way is preferred here.
Waiting for your response.

Thanks in Advance.
Prabhata
My scenario is to calculate the holidays for an opportunity.  For this i have created an custom field(DateType: Integer) in opportunity called "Holidayslist__c"(This field i want to display no of holidays).
1.If my opportunity is in "Open" , i want to calculate the holidays between the opportunity CreatedDate field to TODAY.
2.If Opportunity is "Closed", i want to calculate the holidays between the CreatedDate field to ClosedDate.
I wrote a trigger its working , is there anyother option to do this scenario in configuration part like using  visual flow. Can anyone give me suggestion how to do this please.