VBA If new week (Sunday) then cell value = "1".. "2"..

Lewzerrrr

Active Member
Joined
Jan 18, 2017
Messages
256
Hey,

Not sure how to go about this but I need to populate a cell with the value of 1 - 52 using my work calendar.

Currently I'm in week 1 so throughout this week, whenever I open the workbook A1 needs to be "1" and then on Sunday - Saturday if I'm to open the workbook it needs to be "2".. following Sunday - Saturday onwards "3".

Any help would be appreciated!

Thanks,
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Can't you just use the WEEKNUM function?

=WEEKNUM(TODAY())
 
Last edited:
Upvote 0
Try this formula and amend 27/08/2017 to whatever your start date is , I'm in UK so it's entered as UK format but put in your own regions formatting


Code:
=ROUNDDOWN((DATEDIF("27/08/2017",TODAY(),"d")/7),0)+1
 
Upvote 0
Scott's idea might be best as it's an excel function, it starts from 1 Jan but you can tweak it by subtracting the number of days between 1 Jan and 27 Aug to customise it

=WEEKNUM(TODAY()-238)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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