WEEKNUM

kmacd6951

Board Regular
Joined
Mar 3, 2004
Messages
58
In Excel there is WEEKNUM function to tell you the Week # for a given date. You can also specify whether you want weeks to begin on Sunday or Monday by using a "1" or "2" in your expression.

In Access, I have gotten as far as using FORMAT(fieldname, "ww")
This gives me the week number, but it is doing it based on the week starting on a Sunday and I need it to start the weeks on Monday's.

Any suggestions?

Thanks
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Not quite.....

Here is my Expression in the Expression Builder:

Created Week: Format([SWB_SW_CASE]![SWDATECREATED],"ww",[vbMonday])

It put the [ ] brackets around vbMonday when I saved the Query.

However, when I go to run this query, it is now prompting me with a pop up box that says vbMonday
Do you know why? Or how to prevent that?
When I take out the vbMonday, it runs fine, except that the weeks start on Sunday ;)

Thanks
 
Upvote 0
Not sure why it did that but if you go into SQL view and remove the brackets around vbMonday, you should be good.
 
Upvote 0
I tried removing the [ ] through SQL view. It removed them, but I am still getting the pop up for vbMonday
If I leave it blank, I don't get any results back for my query.
Odd... ?!??!

Any other ideas on this one? :)

Thanks
 
Upvote 0
I Got it!!!

Needed to use a "2" which represents vbMonday

OHhhh! And ... I just noticed that CT Witter suggested that! Thank you
 
Upvote 0
Almost got it that is...

How do I change it so that the value doesn't export to Excel as a text field, but rather a number?
I tried to right click and set the properties to make it a General Number, but it still exported to Excel as Text.
 
Upvote 0
You could try using the DatePart(interval, date[,firstdayofweek[, firstweekofyear]]) Function which is, for a change, better than its Excel equivelent!

Peter
 
Upvote 0

Forum statistics

Threads
1,221,657
Messages
6,161,084
Members
451,684
Latest member
smllchng5

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top