View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pete_UK Pete_UK is offline
external usenet poster
 
Posts: 8,856
Default changing dates and years with less keystrokes

The "weird" stuff, as you call it, is actually the serial number
underlying the date - Excel records dates internally as the number of
elapsed days from some starting point (01/01/1900), so 39449 is just
the number of elapsed days from that point. This explains how the A1+1
formula works - it just makes the next day in sequence. If you apply
the custom formatting to A2 you should see Wednesday 01/02/2008.
Highlight the complete column by clicking on the A at the top of the
column and then do Format | Cells | Number tab | Custom and then set
it up as dddd mm/dd/yyyy.

Then if you put the formula:

=IF(WEEKDAY(A1)=6,A1+3,A1+1)

in A2 and copy it down, you will see the format you want for dates
where weekends are omitted. Essentially this formula says if the date
on the previous row is a Friday then add 3 to the date (jumping to the
next Monday), otherwise just add one to the previous date (to make the
next one in sequence). You should ensure that your date in A1 is for a
working day.

Hope this helps.

Pete

On Jan 19, 7:15*pm, DC wrote:
Pete, I'm getting further along. *Here's where I am. *In A1 I have the date:
01/01/2008. *Then I have applied the Format/Cell/Number Tab/Custom dddd
mm/dd/yyyy. *And that works perfectly just as you'd said it would. *So that
gives me something to work from. *Then I went back through your other
suggested formulas and have tried each one. *The one that works is the very
first one - so in A2 I have inserted the formula: =A1+1. *And I copied that
down through my spread sheet. *And all the days and dates come out perfectly.
*When I change the year in A1 from 2008 to 2009 all the other columns change
to 2009 as well as the days line up perfectly with those dates as well. *
That's just what I wanted. *However ... and this is not a huge problem for me
.... I still have Saturday and Sunday each week. *Now when I do the formulas
for columns B, C, D and so forth to complete the rest of my spreadsheet the
only difficulty is skipping over Saturday and Sunday because they are not
active trading days. *I can do that if I have to. *

I tried your formula: =IF(WEEKDAY(A1)=6,A1+3,A1+1) and I get some weird
(""}}39449) stuff, and I've tried the other formula: =WORKDAY(A2,1) and what
shows in A2 is #NAME. *So I don't know what to do with that. *Any other
thoughts. *We're almost there.

--
DC



"Pete_UK" wrote:
Actually, it will show you Tuesday 01/01/08 after you apply the
formatting !!


Pete


On Jan 19, 12:45 pm, Pete_UK wrote:
You should type the date only, i.e. 01/01/08.


THEN, you apply the custom formatting of dddd mm/dd/yyyy.


It will show you Monday 01/01/2008.- Hide quoted text -


- Show quoted text -