Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Subtract 1 year from todays date

I have looked and I know it must be eady but I want to subtract 1 year from
todays date in code, so I tried date-1 year but to no avail, I can use
date-365 but I would like it to automatically take into account leap years

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Subtract 1 year from todays date

This formular in code may work

1_yr_before = DateSerial(Year(Now()) - 1, Month(Now()), Day(Now()))

yc
"Nigel" wrote in message
...
I have looked and I know it must be eady but I want to subtract 1 year from
todays date in code, so I tried date-1 year but to no avail, I can use
date-365 but I would like it to automatically take into account leap years

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 180
Default Subtract 1 year from todays date

=date(year(date())-1,month(date()),day(date())) will take today's month/day
and the prior year. I'm not sure what you'd get on Feb 29 ;-).

"Nigel" wrote:

I have looked and I know it must be eady but I want to subtract 1 year from
todays date in code, so I tried date-1 year but to no avail, I can use
date-365 but I would like it to automatically take into account leap years

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Subtract 1 year from todays date

using a formula: =EDATE(TODAY(),-12)
using VBA: dateadd("yyyy",-1,date)

cheers - voodooJoe

"Nigel" wrote in message
...
I have looked and I know it must be eady but I want to subtract 1 year from
todays date in code, so I tried date-1 year but to no avail, I can use
date-365 but I would like it to automatically take into account leap years

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
is there a formula that will subtract todays date from a hire date Heather Excel Worksheet Functions 5 April 25th 23 07:44 PM
How do I subtract todays date from range of dates AHD3 Excel Worksheet Functions 2 March 10th 10 09:30 PM
Subtract one year from todays date Nigel Excel Discussion (Misc queries) 6 May 1st 08 06:06 PM
Subtracting 1 year from todays date Alan B Excel Worksheet Functions 9 September 29th 07 04:07 AM
subtract year and divide crystal Excel Worksheet Functions 7 October 26th 05 12:52 AM


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

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

About Us

"It's about Microsoft Excel"