Populate days of the month in a column by checking on date

J

Joe

Is it possible to populate a column with the days of any given month by
checking on a cell reference to a date?

For example if A1 contained 2/28/2009 is there a way for the system
to populate B1 through B28 with the dates of the month? Then if you changed
A1 to 3/31/2009 have it populate B1 through B31 with the dates for March?
 
T

T. Valko

Try this...

A1 = any date

Enter this formula in A2:

=A1-DAY(A1)+1

Enter this formula in A3 and copy down to A32:

=IF(DAY(IF(A2="",0,A2)+1)>DAY(A$2),A2+1,"")

Format A2:A32 as Date

If A1 is empty the dates returned will be for January 1900.
 
T

T. Valko

Ooops!

I put the formulas in the wrong locations! You wanted the results in B1:B31.

Ok.

Enter this formula in B1:

=A1-DAY(A1)+1

Enter this formula in B2 and copy down to B31:

=IF(DAY(IF(B1="",0,B1)+1)>DAY(B$1),B1+1,"")
 
J

Joe

Now that is really cool!

T. Valko said:
Ooops!

I put the formulas in the wrong locations! You wanted the results in B1:B31.

Ok.

Enter this formula in B1:

=A1-DAY(A1)+1

Enter this formula in B2 and copy down to B31:

=IF(DAY(IF(B1="",0,B1)+1)>DAY(B$1),B1+1,"")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top