Skip to main content
Solved

Formula for showing the *next* Saturday

  • April 5, 2024
  • 2 replies
  • 36 views

Forum|alt.badge.img+15

I generate records through the week that all pertain to an event on Saturday. For organising these records into a week-by-week historical view (and for ease of human use on Saturday), I want to be able to automatically tag all of these records for the Saturday they pertain to.

 

I have searched and tried a few things - this is the formula I got closest with:

IF(WEEKDAY(Created)=6,
DATEADD(Created,0,"days"), 
DATEADD(Created,6+WEEKDAY({Created}),"days"))
 
Where "Created" is the date the record is generated.
 
However, this generates a record for the previous Saturday. I don't really understand the formula I've cobbled together from old threads well enough to understand why.
 
Does anyone have any advice to get it to fill that date as the following saturday from the "date created"?

Best answer by pressGO_design

If you create the record on a Saturday, do you want it to show that Saturday or the next one?

DATEADD(Created, 6-WEEKDAY(Created), ‘days’)
^^^if you create it on Saturday 6 April it will show 6 April

IF(
   WEEKDAY(Created)=6,
      DATEADD(Created, 7, ‘days’),
         DATEADD(Created, 6-WEEKDAY(Created), ‘days’)
)
^^^if you create it on 6 April it will show 13 April

2 replies

pressGO_design
Forum|alt.badge.img+21

If you create the record on a Saturday, do you want it to show that Saturday or the next one?

DATEADD(Created, 6-WEEKDAY(Created), ‘days’)
^^^if you create it on Saturday 6 April it will show 6 April

IF(
   WEEKDAY(Created)=6,
      DATEADD(Created, 7, ‘days’),
         DATEADD(Created, 6-WEEKDAY(Created), ‘days’)
)
^^^if you create it on 6 April it will show 13 April


Forum|alt.badge.img+15
  • Author
  • Known Participant
  • April 6, 2024

If you create the record on a Saturday, do you want it to show that Saturday or the next one?

DATEADD(Created, 6-WEEKDAY(Created), ‘days’)
^^^if you create it on Saturday 6 April it will show 6 April

IF(
   WEEKDAY(Created)=6,
      DATEADD(Created, 7, ‘days’),
         DATEADD(Created, 6-WEEKDAY(Created), ‘days’)
)
^^^if you create it on 6 April it will show 13 April


 

Thanks! That works 🙂