# date to week number of the year

#### jamielill

##### Active Member
I want to find the week of the year were this lands

If i have a date that could be

june/31/2012 or

jun/1/2012

would it be best to extract the text from the left end of the date

match it to a month 1 to 12

extract the 6 & 7th character from the right of the date
match it to the day of the week

the use Chips formula for week of the year.

or am I over complicating things to much

Is there an excel command that does this in 2003

### Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a \$25,000 loan, 5% annual interest, 60 month loan.
There is a function called Weeknum

Assuming the date in A1 is a real date, not just a text string that looks like a date.
=WEEKNUM(A1)

This does require the analysis toolpack from Tools - Addins.

thanks it is a text string though

Try

=WEEKNUM(REPLACE(A1,1,FIND("/",A1)-1,MONTH(LEFT(A1,FIND("/",A1)-1)&1)))

Try

=WEEKNUM(REPLACE(A1,1,FIND("/",A1)-1,MONTH(LEFT(A1,FIND("/",A1)-1)&1)))

Or this way...

=WEEKNUM(1*SUBSTITUTE(SUBSTITUTE(A1,"/"," ",1),"/",", "))

Or this way...

=WEEKNUM(1*SUBSTITUTE(SUBSTITUTE(A1,"/"," ",1),"/",", "))

Nice..

FYI, you don't need to coerce the substitute to number with 1*
Weeknum does it for you.

FYI, you don't need to coerce the substitute to number with 1*
Weeknum does it for you.
Thanks for noting that. I needed the coercion in my test to force the date, then I simply wrapped it with the WEEKNUM function... I didn't even think to try removing the coercion after doing that.

Thanks guys
I was going to us vlookup & mid and replace the text with a number then lookup the number of the week

Replies
2
Views
639
Replies
1
Views
469
Replies
11
Views
602
Replies
10
Views
730
Replies
1
Views
282

1,211,869
Messages
6,104,472
Members
447,910
Latest member
abrook1308

### 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.

### Which adblocker are you using?

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

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