StephenJagger
Oct 14 2004, 06:47 AM
Afternoon All,
I'm having a bit of a thick day today, can't seem to work this out.
I've got these two fields on a form which works out the current week for this year.
[StartCurrentWeekTy]
=Date()-Weekday(Date(),0)+1
[EndCurrentWeekTy]
=Date()-Weekday(Date(),0)+7
I need to be able to also add the fields for the current week for last year??
[StartCurrentWeekPy]
???????? (result should be 13/10/2003)
[EndCurrentWeekPy]
???????? (result should be 19/10/2003)
I've tried using dateadd to remove the year but the days are wrong,
Any help will be greatly appreciated
khaos
Oct 14 2004, 07:21 AM
Try this
=dateadd( "yyyy",-1,Date())-Weekday(dateadd( "yyyy",-1,Date()),0)+1
Don't know if this is what you want but hopefully it helps,
Ken
StephenJagger
Oct 14 2004, 07:30 AM
Thanks Ken
That works a treat.
khaos
Oct 14 2004, 07:40 AM
You're welcome, glad to help.
StephenJagger
Oct 15 2004, 05:05 AM
What would be the best way to calculate the equivelant day last year to today.
ie today is friday 15th
last years equivelant friday would be the 17th
khaos
Oct 15 2004, 07:24 AM
What makes that last years equivelant to you? They don't have the same day number in the year
today is day 289
10/17/2003 is day 290
I can use vb to get those. Do you just want the friday of the week that has Oct. 15th in it? I'm sure I could modify or write something for that.
Ken
StephenJagger
Oct 15 2004, 08:02 AM
Hi ken,
In our company we compare sales against last years sales on a day vs day basis, not date vs date.
It's so that our sales for our busiest day saturday would never be compared to a sunday, which would
happen if we were comparing dates.
hope this makes sense
khaos
Oct 15 2004, 08:22 AM
This statement will return the same day of the week for a day supplied.
dateadd( "d",weekday(#10/14/2004# ,vbSunday)-weekday(Dateadd("yyyy",-1,#10/14/2004#),vbSunday),Dateadd("yyyy",-1,#10/14/2004#))
I think thats what you want.
Tell me if you have any problems, working out these types of issues is a lot of fun and a good learning experience for me.
Ken
StephenJagger
Oct 18 2004, 09:08 AM
thanks ken
khaos
Oct 18 2004, 09:09 AM
You're welcome
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.