wonderlips wrote:
Hi Barry,
Wow! Your responses to my problem makes a lot more sense when I can see the graphics you sent with them. Not sure what I was looking at, but it didn't contain the screenshots. Below is a representation of what I'm trying to accomplish. (Sorry, but I don't know how to provide a screenshot of the actual doc in this post.)
Screenshots are taken using shift-command-4, then dragging the crosshair cursor to enclose the part of the screen you want to copy. The file is copied to your desktop as a PNG (portable network graphics) file named Picture 1 (with numbers ranging from 1 to 10), which you can then go to the finder and rename.
Upload the file to a picture storage site (there are many free ones on the 'net) and store it in an album there. For most sites, clicking on your image (or just moving the pointer over it) will give a list of codes to paste into a message to call that image.
Use the one labeled HMTL. Copy the code, then paste it into your message.
You can see an example of the code used by clicking Reply on any message here showing an image, then clicking the quote button ( ” ) to see the text and HTML codes in the message itself. (Click the discard and Cancel button below the message space if you don't actually want to reply to that message.)
Hope the formatting doesn't completely go away when you get this.
It does, pretty much. The forum software parses out multiple spaces. Still readable if the reader has an idea what it should look like, and more readable using the technique described above for seeing HTML codes in a message.
Anyway I can't get the DATE or DAY functions to track properly between cells, because the DAY function converts text into a number,
DAY() does absolutely nothing with text, except return an error message:
"DAY requires a date but found a string instead."
A cell containing a Date and Time value may be formatted to show only the date portion in any of the following forms:
No matter which of those is visible in the cell, the cell does NOT contain a text string and does NOT contain a number. The cell contains a Date and Time value in which the Date portion is the value for the ninth day of February in the 2006th year of the common era.
and the DATE function converts a date into a number, and the the two functions don't play nice with each other.
Actually DATE works in the opposite direction. It constructs a date from three separate numbers.
The syntax is DATE(year,month,day)
DATE(2006,2.9) will construct the Date and Time value for February 9, 2006 and set the time value to 0:00:00 (midnight). Depending on the format set for the cell containing the function, the date will display in one of the forms shown in the list above.
Once the DAY function converts a date into a plain number, it won't reset after 30 and 31. In fact it seems to treat any reference to that cell as a one.
DAY does return a (plain) number in the range 1-31. If you add 1 to that +number+, you'll get a number in the range 2-32. If you add 1 to the +date+ that DAY extracted that number from, you'll get a number in the range 2-31, or if the new date is in the next month, you'll get the number 1.
Now that I've seen the graphics that were supposed to come with your posts, it looks like the answer may be a set of reference cells in another table that I can hide from view in the printed form of my chart.
There's no need for a second table just to get the day numbers in your example. You may need a LOOKUP table to convert the 1s to the shortened name of the current month, though, and that LOOKUP table can be placed on a second table.
Here's my take on the problem as currently described. Description below.
Column A contains the starting date in Cell A1. The format is set to display this date including the name of the weekday to ensure the calendar starts on a Monday. (Necessary because the weekday labels in row 2 are entered text, not constructed from the date information being placed on the calendar.)
A5, and every 4th row after contains a formula that adds 7 to the date in the cell four rows above.
=$A1+7
B1 contains a formula that extracts the DAY (of the month) from the date in A1, plus a calculation that allows it to increment the date when filled into the columns to the right.
=DAY($A1+COLUMN()-2)
The desire to replace "1" in C1 with "Jun" (the shortened name of the new month) makes the formula a bit more complicated:
=IF(condition,TRUE: do this,FALSE:do this)
=IF(DAY($A1+COLUMN()-2)=1,LOOKUP(MONTH($A1+COLUMN()-2),Month Lookup :: $A$1:$A$12,Month Lookup :: $B$1:$B$12),DAY($A1+COLUMN()-2))
condition: DAY($A1+COLUMN()-2)=1
as above, the formula extracts the (adjusted) day number from the date in A1, then compares it with the number 1.
If they're equal the comparison evaluates as TRUE, and the formula does this part:
LOOKUP(MONTH($A1+COLUMN()-2),Month Lookup :: $A$1:$A$12,Month Lookup :: $B$1:$B$12)
MONTH() returns the number of the month of the adjusted date in A1, then looks up that value (6) in column A of the table Month Lookup, and returns the corresponding text string ("Jun") from column B of that table.
If the day number is not equal to 1, the comparison evaluates as FALSE, and the fomula does the last part:
DAY($A1+COLUMN()-2)
and returns the day number of the (adjusted) date.
Constructing the tables:
Month Lookup table
Enter 1 in A1 and 2 in A2.
Select both cells and drag the coltrol down to fill to row 12.
Enter Jan in B1
Select B1 and drag the control down to fill ro row 12 (Dec)
Calendar table
Enter a starting date in A1.
Enter
=IF(DAY($A1+COLUMN()-2)=1,LOOKUP(MONTH($A1+COLUMN()-2),Month Lookup :: $A$1:$A$12,Month Lookup :: $B$1:$B$12),DAY($A1+COLUMN()-2))
in B1.
Select B1 and drag the fill control right to fill B1:H1
(See optional formatting below for adding colour to month names)
Select B1:H1 and Copy
Select B5 and Paste.
Enter
=A1+7
in A5.
Select A2:H5 (as shown in graphic above)
Drag the control down as many rows as you need.
Optional formatting
The red month names on yellow backgrounds are created using Conditional formatting for the seven cells B1:H1 (and similar cells further down the table).
If you choose to do this, it's best to do so where "See optional formatting..." is placed in the instructions.
Select B1:L1
In the Format bar above the tables, set the Text colour to red and the Fill colour to yellow. (This will change the colours in all cells in the row.)
Open the Inspector and click the Cell Format button.
Click the Conditional Format checkbox to check it. Click Show Rules.
From the Choose a Rule popup, choose "Less than or Equal to" and enter 31 in the box that appears.
Choose Black for the conditional text colour and white for the conditional fill colour.
Continue with the instructions for Constructing the Tables.
Regards,
Barry