function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Chad RitchieChad Ritchie 

Need Help with Date Formula

Hey guys,

I would like to create a date formula that takes the last day of the current month and subtracts 7 business days from it. This part isn't too complicated to do with the Weekday function, but how would be the best way to deal with holidays. For example Christmas is right around the corner, so how could I tell this formula, without necessarily hardcoding it every year, to not ever count the 25th day of December? Here's kind of the foundation of my formula: (IF( MONTH( TODAY() ) = 12,
DATE( YEAR( TODAY() ), 12, 31 ),
DATE( YEAR( TODAY() ), MONTH( TODAY() ) + 1, 1) - 1) - 7
but I'm not sure where to start on the Holidays issue and I haven't had much luck using the Sobject Holidays..

Thanks!!!
Banwari KevatBanwari Kevat
Hi Chad,
    I don't think Holiday sObject record is accessible in Formula Field. 
If you really want that field populated then you required trigger where you can substract holidays.

Regards,
Banwari 
Chad RitchieChad Ritchie
Alright thanks for the info Banwarl. Do you know how the formula would look if I needed to find the date that's 7 weekdays from the last day of the month? Basically the same question without holidays, I'm struggling to get the weekday function to work for this. Thanks
KrishnaAvvaKrishnaAvva
Hi Chad,

Did you get a chance to go through this discussion?
https://developer.salesforce.com/forums/?id=906F00000008wNHIAY

Regards,
Krishna Avva