Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Range of Days in a month

I am trying to list the dates in the current month (from the 1st to
the 28th, or 29th, or 30th, or 31st, depending on the month), in a
range of cells, one day per cell.

Is it me, or are the date functions in excel way too complicated?

I've experimented with the Now() and Today() functions, with no luck.

Can someone give me an idea on how to do this?

I'd prefer not to use a macro, because it is not something i want to
have to manually start every time I open the spreadsheet.


Any clues would be greatly appreciated.

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Range of Days in a month

On Jun 25, 10:32 pm, Ron Rosenfeld wrote:
On Mon, 25 Jun 2007 19:15:46 -0700, wrote:
I am trying to list the dates in the current month (from the 1st to
the 28th, or 29th, or 30th, or 31st, depending on the month), in a
range of cells, one day per cell.


Is it me, or are the date functions in excel way too complicated?


I've experimented with the Now() and Today() functions, with no luck.


Can someone give me an idea on how to do this?


I'd prefer not to use a macro, because it is not something i want to
have to manually start every time I open the spreadsheet.


Any clues would be greatly appreciated.


Thanks.


Here's one possible way:

A1: =DATE(YEAR(TODAY()),MONTH(TODAY()),1)
A2: =IF(MONTH($A$1+ROWS($1:1))=MONTH($A$1),$A$1+ROWS($ 1:1),"")

Fill down to A31

--ron- Hide quoted text -

- Show quoted text -



Thanks for the response Ron.

The first and second rows worked and gave me Jun 1st and Jun 2nd. But
the rest (3 - 31) also come up as June 2nd.


I

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Range of Days in a month

Here's one possible way:

A1: =DATE(YEAR(TODAY()),MONTH(TODAY()),1)
A2: =IF(MONTH($A$1+ROWS($1:1))=MONTH($A$1),$A$1+ROWS($ 1:1),"")

Fill down to A31

--ron- Hide quoted text -

- Show quoted text -


Thanks for the response Ron.

The first and second rows worked and gave me Jun 1st and Jun 2nd. But
the rest (3 - 31) also come up as June 2nd.


Check what you did again... it worked fine for me.

Rick
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Range of Days in a month

On Jun 25, 11:17 pm, "Rick Rothstein \(MVP - VB\)"
wrote:
Here's one possible way:


A1: =DATE(YEAR(TODAY()),MONTH(TODAY()),1)
A2: =IF(MONTH($A$1+ROWS($1:1))=MONTH($A$1),$A$1+ROWS($ 1:1),"")


Fill down to A31


--ron- Hide quoted text -


- Show quoted text -


Thanks for the response Ron.


The first and second rows worked and gave me Jun 1st and Jun 2nd. But
the rest (3 - 31) also come up as June 2nd.


Check what you did again... it worked fine for me.

Rick


The answer is that my workbook was not doing calculations, but
manually.

Ron, I am in awe. Thanks again!

BTW, that second formula is definitely ugly.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Range of Days in a month

On Mon, 25 Jun 2007 19:55:53 -0700, saphite wrote:

On Jun 25, 10:32 pm, Ron Rosenfeld wrote:
On Mon, 25 Jun 2007 19:15:46 -0700, wrote:
I am trying to list the dates in the current month (from the 1st to
the 28th, or 29th, or 30th, or 31st, depending on the month), in a
range of cells, one day per cell.


Is it me, or are the date functions in excel way too complicated?


I've experimented with the Now() and Today() functions, with no luck.


Can someone give me an idea on how to do this?


I'd prefer not to use a macro, because it is not something i want to
have to manually start every time I open the spreadsheet.


Any clues would be greatly appreciated.


Thanks.


Here's one possible way:

A1: =DATE(YEAR(TODAY()),MONTH(TODAY()),1)
A2: =IF(MONTH($A$1+ROWS($1:1))=MONTH($A$1),$A$1+ROWS($ 1:1),"")

Fill down to A31

--ron- Hide quoted text -

- Show quoted text -



Thanks for the response Ron.

The first and second rows worked and gave me Jun 1st and Jun 2nd. But
the rest (3 - 31) also come up as June 2nd.


I


Most likely explanations: Either you did not enter the formula in A2 as I
posted it, or you did not use the Excel Fill Down command.

Check to see that the ROWS($1:1) is entered properly with the "$" before the
first "1".

Check that $A$1 is entered with the "$"'s.

Select A2:A31. Then Edit/Fill/Down.
--ron
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Range of Days in a month

On Jun 25, 10:32 pm, Ron Rosenfeld wrote:
On Mon, 25 Jun 2007 19:15:46 -0700, wrote:
I am trying to list the dates in the current month (from the 1st to
the 28th, or 29th, or 30th, or 31st, depending on the month), in a
range of cells, one day per cell.


Is it me, or are the date functions in excel way too complicated?


I've experimented with the Now() and Today() functions, with no luck.


Can someone give me an idea on how to do this?


I'd prefer not to use a macro, because it is not something i want to
have to manually start every time I open the spreadsheet.


Any clues would be greatly appreciated.


Thanks.


Here's one possible way:

A1: =DATE(YEAR(TODAY()),MONTH(TODAY()),1)
A2: =IF(MONTH($A$1+ROWS($1:1))=MONTH($A$1),$A$1+ROWS($ 1:1),"")

Fill down to A31

--ron- Hide quoted text -

- Show quoted text -


So cool!

Here's something odd though:

I dragged and filled 3-31 and they all came out as Jun 2nd.

I then changed the number in the second ROWS statement to +1, and then
back to the original.

The dates then incremented correctly.

Thanks ron!

Maybe if you have time you can explain exactly why that works, so I
can learn?


Joe

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Range of Days in a month

On Mon, 25 Jun 2007 20:14:02 -0700, saphite wrote:

On Jun 25, 10:32 pm, Ron Rosenfeld wrote:
On Mon, 25 Jun 2007 19:15:46 -0700, wrote:
I am trying to list the dates in the current month (from the 1st to
the 28th, or 29th, or 30th, or 31st, depending on the month), in a
range of cells, one day per cell.


Is it me, or are the date functions in excel way too complicated?


I've experimented with the Now() and Today() functions, with no luck.


Can someone give me an idea on how to do this?


I'd prefer not to use a macro, because it is not something i want to
have to manually start every time I open the spreadsheet.


Any clues would be greatly appreciated.


Thanks.


Here's one possible way:

A1: =DATE(YEAR(TODAY()),MONTH(TODAY()),1)
A2: =IF(MONTH($A$1+ROWS($1:1))=MONTH($A$1),$A$1+ROWS($ 1:1),"")

Fill down to A31

--ron- Hide quoted text -

- Show quoted text -


So cool!

Here's something odd though:

I dragged and filled 3-31 and they all came out as Jun 2nd.

I then changed the number in the second ROWS statement to +1, and then
back to the original.

The dates then incremented correctly.

Thanks ron!

Maybe if you have time you can explain exactly why that works, so I
can learn?


Joe


Dates are stored as serial numbers.

So to increment by one day, one adds "1".

I chose to use A1 as the index, and add 1,2,3... to that value.

That number to add is computed by the ROWS() function.

If you examine the formulas in the subsequent cells to A2, you will see that
the ROWS function becomes ROWS($1:2) ROWS($1:3) and so forth.
ROWS($1:2)--2.

Hope that's enough of an explanation, but if not, post back.
--ron
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Range of Days in a month

I am trying to list the dates in the current month (from the 1st to
the 28th, or 29th, or 30th, or 31st, depending on the month), in a
range of cells, one day per cell.


Here's one possible way:

A1: =DATE(YEAR(TODAY()),MONTH(TODAY()),1)
A2: =IF(MONTH($A$1+ROWS($1:1))=MONTH($A$1),$A$1+ROWS($ 1:1),"")

Fill down to A31


Here is a slightly shorter formula that can be used in A2 (filled down to
A31)...

A2: =IF((MONTH(IF(A1="",0,A1)+1)=MONTH($A$1)),A1+1,"")

The formula in A1 stays the same.

Rick

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Range of Days in a month

Here is a slightly shorter formula that can be used in A2 (filled
down to A31)...

A2: =IF((MONTH(IF(A1="",0,A1)+1)=MONTH($A$1)),A1+1,"")


Even shorter...

A2: =IF(MONTH(N(A1)+1)=MONTH($A$1),A1+1,"")

Rick


  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Range of Days in a month

Here's one way:
http://www.dailydoseofexcel.com/arch...ugly-formulas/

Note there's a slight typo in it; change "" to "".

NickHK

wrote in message
ups.com...
I am trying to list the dates in the current month (from the 1st to
the 28th, or 29th, or 30th, or 31st, depending on the month), in a
range of cells, one day per cell.

Is it me, or are the date functions in excel way too complicated?

I've experimented with the Now() and Today() functions, with no luck.

Can someone give me an idea on how to do this?

I'd prefer not to use a macro, because it is not something i want to
have to manually start every time I open the spreadsheet.


Any clues would be greatly appreciated.

Thanks.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel to make the days cary over month to month automaticly GARY New Users to Excel 1 April 19th 08 06:05 PM
Calc Prorated Cost based on Specific Days in a Given Month & Year Range (Revisited..) [email protected] Excel Discussion (Misc queries) 8 October 2nd 07 12:15 AM
CountDays? need to count days in range by month MhyphenL Excel Worksheet Functions 2 January 11th 07 12:50 AM
Calc Prorated Cost based Specific Days in a Gven Month & Year Range. RetailMessiah Excel Programming 3 November 29th 06 03:31 PM
Fomula for number of days on each month from a date range [email protected] Excel Discussion (Misc queries) 3 November 9th 06 03:08 AM


All times are GMT +1. The time now is 03:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"