View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc
Grey Old Man[_2_] Grey Old Man[_2_] is offline
external usenet poster
 
Posts: 24
Default Current year and current week number

Year 2009 now contains a full row of "N"'s.
How have you formatted the cells in row 1 and column A?



"מיכאל (מיקי) אבידן" wrote:

Try this in B2 and copy across:
=IF(YEAR(TODAY())$A2,"Y",IF(AND(YEAR(TODAY())=$A 2,WEEKNUM(TODAY())=B$1),"Y","N"))
Micky


"Grey Old Man" wrote:

Your answer shows year 2008 weeks 51 and 51 as "N" "N" which is incorrect. It
should be "Y" for the whole of 2008 (and indeed 2010). The year 2009 should
show a combination of "Y" "Y" .. until the last few weeks of "N" "N".

My IF (AND( ....,....),"Y","N") logic is flawed.
I am OK with obtaining Current_Year and Current_Week.
Thanks again.


"מיכאל (מיקי) אבידן" wrote:

Be my guest and call it whatever you feel like...
Logic, by itself is not enough as long as we talk "Excelling".
I do hope the picture in the link will speak for itself - OR I didn't
understood your request.
http://img17.imageshack.us/img17/4336/nonamep.png
Micky


"Grey Old Man" wrote:

It's the formula logic rather than the cell addressing that is causing the
problem. My attempt does not return the required results.

"מיכאל (מיקי) אבידן" wrote:

1) You have an extra $ sign - the formula should read:
=IF(AND(YEAR(TODAY())=$A2,WEEKNUM(TODAY())=B$1), "Y","N")
2) I hope you turned on the Analysis Toolpak add-in in order to be able to
use the WeekNum function.
Micky


"Grey Old Man" wrote:

I can obtain the current year with YEAR(TODAY()) and the current week number
with WEEKNUM, but I want to display the results in an ?array. By this I mean;
row 1 contains the week nos 1 -52; column A contains the years 2010,2009,2008.
I want the result to look like:

2010 N N N -----N until week 52
2009 Y Y Y ------ Y until current week, then N N N until week 52
2008 Y Y Y ------ Y until week 52

My current attempt fails, which is
=IF(AND(Current_Year=$A2,Current_Week=$B$1),"Y", "N")

The purpose is to automatically populate a chart (graph) with current data
(Y) and ignore future data (N). Thanks in anticipation.