Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 18
Default Months going back from present

Hello, I am trying to create a column staring with the present month in A12,
going back 12 months to A1. I always want the present month to be in A12 and
then have the previous months going back to A1. I can use MONTH(TODAY()) to
get the month number and use a lookup for the actual month in A12. The
problem I have is that I can't think of a way to go back from January to
December. If I keep reducing the month number, I reach 0, which is not valid
i.e. A12 contains October and A3 January - I need to be able to put December
in A2 and have the column update and rollback when the month changes. Thanks


  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10,593
Default Months going back from present

In A11 use

=A12-1+(A12=1)*12

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"DavidS" wrote in message
...
Hello, I am trying to create a column staring with the present month in

A12,
going back 12 months to A1. I always want the present month to be in A12

and
then have the previous months going back to A1. I can use MONTH(TODAY())

to
get the month number and use a lookup for the actual month in A12. The
problem I have is that I can't think of a way to go back from January to
December. If I keep reducing the month number, I reach 0, which is not

valid
i.e. A12 contains October and A3 January - I need to be able to put

December
in A2 and have the column update and rollback when the month changes.

Thanks




  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 418
Default Months going back from present

DavidS wrote:
Hello, I am trying to create a column staring with the present month in A12,
going back 12 months to A1. I always want the present month to be in A12 and
then have the previous months going back to A1. I can use MONTH(TODAY()) to
get the month number and use a lookup for the actual month in A12. The
problem I have is that I can't think of a way to go back from January to
December.


Would this be simpler for you? Format A1:A12 as Custom "mmm" or "mmmm"
depending on whether you want Jan or January, for example. Then put
=today() into A12, put =date(year(A12),month(A12)-1,day(A12)) into A11,
and copy A11 through A1.

  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 418
Default Months going back from present

Errata....

I wrote:
Would this be simpler for you? Format A1:A12 as Custom "mmm" or "mmmm"
depending on whether you want Jan or January, for example. Then put
=today() into A12, put =date(year(A12),month(A12)-1,day(A12)) into A11,
and copy A11 through A1.


Put =date(year(a12),month(a12)-1,1) into A11. If you use day(A12), you
will get unexpected results when A12 (e.g) contains a day of the month
that the previous month (A11) does not have. For example, if A12 is
12/31/2006, my original formula would result in 12/1/2006 in A11.
Since your original approach did not attempt to retain the full date,
it should be okay to "normalize" all dates to the first of the month.

  #5   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10,593
Default Months going back from present

That approach gets problematical with 30th and 31st.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
DavidS wrote:
Hello, I am trying to create a column staring with the present month in

A12,
going back 12 months to A1. I always want the present month to be in A12

and
then have the previous months going back to A1. I can use MONTH(TODAY())

to
get the month number and use a lookup for the actual month in A12. The
problem I have is that I can't think of a way to go back from January to
December.


Would this be simpler for you? Format A1:A12 as Custom "mmm" or "mmmm"
depending on whether you want Jan or January, for example. Then put
=today() into A12, put =date(year(A12),month(A12)-1,day(A12)) into A11,
and copy A11 through A1.





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
Want average sales numbers for last 12 months. Pierre Excel Worksheet Functions 2 September 29th 06 07:16 PM
i have two days and i want the difference in days, months, year maja Excel Worksheet Functions 7 April 22nd 06 01:14 AM
how to keep previous months' data braadi Excel Worksheet Functions 0 February 9th 06 03:51 PM
Add # of months and get result last day of # months. BDP Excel Discussion (Misc queries) 2 January 25th 06 03:51 AM
Counting dates for a the present month but not future months BrianInCalifornia Excel Worksheet Functions 3 December 7th 05 02:00 AM


All times are GMT +1. The time now is 01:10 AM.

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"