Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating previous business day

Status
Not open for further replies.

QPRphil

IS-IT--Management
Mar 27, 2003
7
NZ
Hi, I am using Crystal 8.5 and want to run a daily report listing entries from a Remedy database that were created on the previous working day (Monday - Friday).
I have created a formula field to calculate the previous day [DateAdd ("d",-1,CurrentDate )], but if this is a Saturday or Sunday, I want the actual date to be that of the preceding Friday.
Any suggestions?
 
I'm not at work, so don't have the correct syntax, but...

Try getting the # indicating the day of the week (thinking maybe a weekday function?) of the current day. If 1 (mon) then -3, if 7 (sun) then -2, else -1.

HTH, Jessica [ponytails2]
 
Try the following in a formula field:

if dayofWeek(currentdate) = 1
then currentdate - 2
else if dayofWeek(currentdate) = 2
then currentdate - 3
else currentdate - 1

Note that Sunday is Day 1, Monday is Day 2 etc.

Madawc Williams
East Anglia
Great Britain
 
Thanks very much for the assistance folks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top