Week number based on the month of the created date?
How would I calculate the week number based on the month of a created date for a record? For example, I want to know if the data collected was provided the 1st, 2nd, 3rd, 4th or 5th (if applicable) week of the month in which the data was provided.
Thanks!
Best Answer
-
=ROUNDDOWN(([Created]@row - DATE(YEAR([Created]@row), MONTH([Created]@row), 1)) / 7, 0)
From the outside in
ROUND has to round it up or down I assume.. you can change the 0 to 1 to get 2.5 weeks versus say 2
I took the Date in the created row minus the 1st of the month (using the created row). You could hardcode the year or the month but I thought this way it could 'float a bit then simply divide by 7 days a week
Again you may want to play and change to a ROUNDUP as you will get 0 weeks if it was say created on the 2nd of the month..
Let me know if that works for you
Brent C. Wilson, P.Eng, PMP, Prince2
Facilityy Professional Services Inc.
http://www.facilityy.com
Answers
-
=ROUNDDOWN(([Created]@row - DATE(YEAR([Created]@row), MONTH([Created]@row), 1)) / 7, 0)
From the outside in
ROUND has to round it up or down I assume.. you can change the 0 to 1 to get 2.5 weeks versus say 2
I took the Date in the created row minus the 1st of the month (using the created row). You could hardcode the year or the month but I thought this way it could 'float a bit then simply divide by 7 days a week
Again you may want to play and change to a ROUNDUP as you will get 0 weeks if it was say created on the 2nd of the month..
Let me know if that works for you
Brent C. Wilson, P.Eng, PMP, Prince2
Facilityy Professional Services Inc.
http://www.facilityy.com
-
Thank you. That seemed to work. I think the Round option is going to work better. Thanks so much!
-
@Brent Wilson I did change it to round up and I am still getting 0 for some of the weeks where it starts on the 1st. Is there anything I can do to force it to give me 1?
-
You could wrap it in an IF and force it to 1 if it is zero
= IF(ROUND(([Created]@row - DATE(YEAR([Created]@row), MONTH([Created]@row), 1)) / 7, 0)=0, 1, ROUND(([Created]@row - DATE(YEAR([Created]@row), MONTH([Created]@row), 1)) / 7, 0))
Obviously ROUND, ROUNDUP, ROUNDDOWN is on your preference
Brent C. Wilson, P.Eng, PMP, Prince2
Facilityy Professional Services Inc.
http://www.facilityy.com
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.8K Get Help
- 434 Global Discussions
- 138 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 65 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!