calling all excel gurus

TdC

Trem's hunky sex love muffin
Joined
Dec 20, 2003
Messages
30,805
peeples, I've discovered that once again I am blocked by my own creativity.

for a certain purpose, I have created the following formula:

Code:
=IF(WEEKDAY(G3,2)=1,TRUNC(((G3-DATE(YEAR(G3),1,1))/7))+1+IF(WEEKDAY(DATE(YEAR(G3),1,1))>WEEKDAY(G3),1,0),"")
the output of this formula in this case happens to be
Code:
2

what I want it to say is
Code:
week 2
in the same cell!!!!

BUT I CANT GET IT TO DO THAT AARGH(^$(%&$(%&$(

HELP ME BEFORE I COMMIT MURDER
 

caLLous

I am a FH squatter
FH Subscriber
Joined
Dec 23, 2003
Messages
18,435
Um well you would put
Code:
"week "&
in there to concatenate the result onto "week ". I didn't go through your formula but if you have a value in B2 and you want C2 to be "week b2" you would say
Code:
="week "&B2
in C2.
 

TdC

Trem's hunky sex love muffin
Joined
Dec 20, 2003
Messages
30,805
thank you caLLous. you just saved 37 lives!
 

Zenith.UK

Part of the furniture
Joined
Dec 20, 2008
Messages
2,913
Code:
="Week "&IF(WEEKDAY(G3,2)=1,TRUNC(((G3-DATE(YEAR(G3),1,1))/7))+1+IF(WEEKDAY(DATE(YEAR(G3),1,1))>WEEKDAY(G3),1,0),"")
There ya go.

[edit] I went away to doublecheck and got snipered on the post. Sorry for the duplication.
 

Jupitus

Old and short, no wonder I'm grumpy!
Staff member
Moderator
FH Subscriber
Joined
Dec 14, 2003
Messages
3,294
Well, yes to what Callous said probably, but what the piffle are you trying to do with that abominable formula???
 

caLLous

I am a FH squatter
FH Subscriber
Joined
Dec 23, 2003
Messages
18,435
Code:
=IF(WEEKDAY(G3,2)=1,"week "&TRUNC(((G3-DATE(YEAR(G3),1,1))/7))+1+IF(WEEKDAY(DATE(YEAR(G3),1,1))>WEEKDAY(G3),1,0),"")
That works for 2, 9, 16 etc but your formula is making my head hurt slightly. :)
 

Jupitus

Old and short, no wonder I'm grumpy!
Staff member
Moderator
FH Subscriber
Joined
Dec 14, 2003
Messages
3,294
Just a quick note - have you deliberately used the return type for the weekday function as 2 for the first use, then just the default weekday return type thereafter, or is that a mistake?
 

TdC

Trem's hunky sex love muffin
Joined
Dec 20, 2003
Messages
30,805
well, it could probably use some tweaking, but what it basically does is, in pseudocode:

Code:
if some cell contains a date that happens to be a monday, 
then let the contents of this cell be "week " and whatever week it happens to be by working it out in a roundabout way

there's prolly a function that directly returns the week number, but I'm pooh at excel so there.
 

TdC

Trem's hunky sex love muffin
Joined
Dec 20, 2003
Messages
30,805
Just a quick note - have you deliberately used the return type for the weekday function as 2 for the first use, then just the default weekday return type thereafter, or is that a mistake?

no, it's deliberate. the first one checks for type 2, eg "Monday"
 

Jupitus

Old and short, no wonder I'm grumpy!
Staff member
Moderator
FH Subscriber
Joined
Dec 14, 2003
Messages
3,294
You'll want to put the "Week "& into the return part of the IF statement then, otherwise the other cells will contain 'Week'.... guess you've figured that part ;)
 

TdC

Trem's hunky sex love muffin
Joined
Dec 20, 2003
Messages
30,805
yes, I figured that part :)
 

pcg79

One of Freddy's beloved
Joined
Dec 22, 2003
Messages
694
well, it could probably use some tweaking, but what it basically does is, in pseudocode:

Code:
if some cell contains a date that happens to be a monday, 
then let the contents of this cell be "week " and whatever week it happens to be by working it out in a roundabout way

there's prolly a function that directly returns the week number, but I'm pooh at excel so there.

Code:
=IF(WEEKDAY(G3,2)=1,"week "&weeknum(g3,2),"")
 

Jupitus

Old and short, no wonder I'm grumpy!
Staff member
Moderator
FH Subscriber
Joined
Dec 14, 2003
Messages
3,294
Nice one dude :)
 

TdC

Trem's hunky sex love muffin
Joined
Dec 20, 2003
Messages
30,805
friggin' ace pcg79, thanks for that :D

now to see if workies' ancient excel can actually do that o0
 

TdC

Trem's hunky sex love muffin
Joined
Dec 20, 2003
Messages
30,805
sadly, our super dinosaur excel has WEEKDAY but not WEEKNUM :(:(:(
 

ST^

Can't get enough of FH
Joined
Dec 22, 2003
Messages
2,351
It should be part of the Analysis Toolpak since at least 2000. Tools -> Add-Ins ... etc
 

TdC

Trem's hunky sex love muffin
Joined
Dec 20, 2003
Messages
30,805
dude, my companies office is so old it very likely watched the dino's die.
 

Users who are viewing this thread

Top Bottom