ShowAll Questionssorted byDate Posted
Peter Jeffery

# previous working day

I was kindly shown how to have a checkbox ticked if the created day or a record was the previous working day (not including weekends), I would now like to adapt this so the checkbox is ticked if the created date is greater or equal to the last working day (not including weekends) but less than today.

The previous post is here:

https://developer.salesforce.com/forums/ForumsMain?id=9060G000000BcNo

Best Answer chosen by Peter Jeffery
So try to edit the formula field "Created Yesterday" to this:
`IF(Today_Name__c='Monday' && DATEVALUE(CreatedDate) >= Today()- 3 && DATEVALUE(CreatedDate) < Today(),true,IF(DATEVALUE(CreatedDate) =Today()- 1,true,false))`

Dont forget to mark as best answer. thank u :)

before, you were checking if the record was created yesterday.
now lets assume that today is Tuesday, the last working day will be monday. lets say thât you created a record on monday, created yesterday will be true. now if you change the condition, the value will be false. even for the rest day it will be false. this doesnt make sense. can you give more details plz
Peter Jeffery
Apologies for the late reply and poor explanation, with the original solution records created on Saturday or Sunday wouldn't be captured but I would like these to be included on Mondays:

Mon = True if created previous Fri, Sat, Sun
Tue = True if created Mon (yesterday)
Wed = True if created Tue (yesterday)
Thu = True if created Wed (yesterday)
Fri = True if created Thu (yesterday)

Regards,

Pete

`IF(Today_Name__c='Monday' && DATEVALUE(CreatedDate) >= Today()- 3 && DATEVALUE(CreatedDate) < Today(),true,IF(DATEVALUE(CreatedDate) =Today()- 1,true,false))`