Re: Excel Question
roverroad wrote:
Tomorrow: 082904
Code:=TODAY()+1
Code:=TODAY()
Code:=TODAY()-1
Quote:Last Sunday: 082204 (Always printed on a Saturday so it would be the date from 6 days before.
Code:=TODAY()-6
Grrr, I got as far as "last sunday" and started hacking out a formula, till I noticed you said it would always be -6.
Quote:Period: 0804 (The month and the year, but always ending on a Saturday. For example, the days of 08/01/04 to 09/04/04 would still be period 0804 and it would change to period 0904 on 09/05/04, because that is the first Sunday of the month.)
This one was
difficult.
Code: =IF(IF(WEEKDAY(MONTH(TODAY())&"/01/"&YEAR(TODAY()),3)>5,12-WEEKDAY(MONTH(TODAY())&"/01/"&YEAR(TODAY()),3),0)+(MONTH(TODAY())&"/1/"&YEAR(TODAY()))=TODAY(),MONTH(TODAY())-1&(YEAR(TODAY())),MONTH(TODAY())&(YEAR(TODAY())))
It basically, it finds out what the first day of the current month is, then it finds out what the first saturday of the month is, then it checks to see if today is the first saturday of the month.
If so, it prints "month-1" and the year.
If not, it prints month and year.
I did not get it to do years like "04" because excel uses years like "2004". So it would make periods like "82004".
If you really need it to be formatted like "0804" then use this formula (only works for post 2000 years).
Code:=IF(IF(WEEKDAY(MONTH(TODAY())&"/01/"&YEAR(TODAY()),3)>5,12-WEEKDAY(MONTH(TODAY())&"/01/"&YEAR(TODAY()),3),0)+(MONTH(TODAY())&"/1/"&YEAR(TODAY()))=TODAY(),"0"&MONTH(TODAY())-1&"0"&(YEAR(TODAY())-2000),"0"&MONTH(TODAY())&"0"&(YEAR(TODAY())-2000))
Quote:Week: 34 (The number of weeks that have passed for the current calendar year)
Code:=DAYS360("1/01/"&YEAR(TODAY()),TODAY())/7
Regards
PS. thanks for asking this question, it made me learn as much as you did.
PPS. if your boss ever gets on you for surfin' a2k, show them this thread. When my ole boss saw how many work answers I got through a2k he told everyone in the company to use it as their homepage.