Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Peter W
 
Posts: n/a
Default Weeknum Goes Missing

Hi
I am using WEEKNUM function in a series of MACRO routines. Problem is they
work really well than sometimes for no apparent reason I get the #NAME error
command. I go back into the Add-Ins Menu, remove the selection on Analysis
Tool Pak, go out. Then go back in and re-select then Analysis Tool Pack - it
then works again. It took me a little while to work through this fix - and
lot of hair pulling!!

Does anyone have any suggestions as to what may be causing it?

Regards
  #2   Report Post  
nbrcrunch
 
Posts: n/a
Default


Can't answer why the function is failing on you, but have you considered
writing your own weeknum() function. It can't be that hard. Here's a
simple formula to return the weeknum value:

=INT((TODAY()-DATE(YEAR(NOW()),1,1))/7)

The problem with the above is that it calculates the number of 7-day
weeks that have pasted, not the numeric position of the week we are
currently in, but my point is that a home-crafted formula might be a
solution.

(The above formula returns "6" used today, 2/16/2005 whereas weeknum()
returns "8".)


--
nbrcrunch
  #3   Report Post  
Peter W
 
Posts: n/a
Default

Thanks for the suggestion - which I will use. But I would still like to know
why I have to trick Weeknum to work.

Regards

"nbrcrunch" wrote:


Can't answer why the function is failing on you, but have you considered
writing your own weeknum() function. It can't be that hard. Here's a
simple formula to return the weeknum value:

=INT((TODAY()-DATE(YEAR(NOW()),1,1))/7)

The problem with the above is that it calculates the number of 7-day
weeks that have pasted, not the numeric position of the week we are
currently in, but my point is that a home-crafted formula might be a
solution.

(The above formula returns "6" used today, 2/16/2005 whereas weeknum()
returns "8".)


--
nbrcrunch

  #4   Report Post  
nbrcrunch
 
Posts: n/a
Default


Update:

I recently found on Pearson's website both a formula and VBA code for
calculating week numbers without the need for the Analysis Toolkit
add-in.

I tested the formula against the weeknum() function for all dates in
this current (2005) calendar year and it returned the same value for
each date.

First, credit where credit is due:
http://www.cpearson.com/excel/DateTimeWS.htm
http://www.cpearson.com/excel/weeknum.htm

See the first link for the formula he recommends and the second link
for a VBA module that will do the same thing.


--
nbrcrunch
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
missing data from table kg1953 Excel Discussion (Misc queries) 1 February 2nd 05 05:11 PM
missing data from table kg1953 Excel Discussion (Misc queries) 0 February 2nd 05 04:59 PM
Missing values in Excel Line Chart mw55309 Charts and Charting in Excel 1 January 19th 05 12:10 PM
Weeknum Christine Excel Worksheet Functions 3 December 17th 04 10:55 AM
how can i get the slope function to ignore missing data? Delmar Excel Discussion (Misc queries) 0 December 2nd 04 05:55 PM


All times are GMT +1. The time now is 12:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"