Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Tsjah
 
Posts: n/a
Default Trying to get the next date exactly 5 years ago..

I use the following function(s) in a list of dates (ascending, obviously) to

=VLOOKUP(DATE(YEAR(NOW())-5;MONTH(NOW());DAY(NOW()));$A:$A;1)

This gives me either today, or the last occurance of the same day 5 years
ago if today is not available. I know what causes this, but can anybody give
me a not too complicated formula for getting the next one?

Thanks a lot!

Mike


  #2   Report Post  
Tsjah
 
Posts: n/a
Default

Never mind, I've figured it out myself:

=IF(VLOOKUP(DATE(YEAR(NOW())-5;MONTH(NOW());DAY(NOW()));$A:$A;1)=DATE(YEAR(NOW( ))-5;MONTH(NOW());DAY(NOW()));INDIRECT(ADDRESS(MATCH( DATE(YEAR(NOW())-5;MONTH(NOW());DAY(NOW()));$A:$A;1);1));INDIRECT(A DDRESS(MATCH(DATE(YEAR(NOW())-5;MONTH(NOW());DAY(NOW()));$A:$A;1)+1;1)))

Thanks anyway,

Mike


  #3   Report Post  
bj
 
Posts: n/a
Default

I don't know why it would give you today??
If every day is present It will give you 5 years ago, but if every date is
not present, it would give you the last date before the 5 years ago date.

I would add a ",false" to the end of your lookup formula. this would make
it give only the 5 year ago date or an error if not present.
I am not sure what you mean by "next one" if you mean ten years ago try
=if(iserror(VLOOKUP(DATE(YEAR(NOW())-5;MONTH(NOW());DAY(NOW()));$A:$A;1,False)),VLOOKUP (DATE(YEAR(NOW())-10;MONTH(NOW());DAY(NOW()));$A:$A;1,False),VLOOKUP (DATE(YEAR(NOW())-5;MONTH(NOW());DAY(NOW()));$A:$A;1,False))




"Tsjah" wrote:

I use the following function(s) in a list of dates (ascending, obviously) to

=VLOOKUP(DATE(YEAR(NOW())-5;MONTH(NOW());DAY(NOW()));$A:$A;1)

This gives me either today, or the last occurance of the same day 5 years
ago if today is not available. I know what causes this, but can anybody give
me a not too complicated formula for getting the next one?

Thanks a lot!

Mike



  #4   Report Post  
Tsjah
 
Posts: n/a
Default


"bj" wrote in message
...
I don't know why it would give you today??
If every day is present It will give you 5 years ago, but if every date is
not present, it would give you the last date before the 5 years ago date.


That's what I was trying to say, forgot a comma..

Mike

"Tsjah" wrote:

I use the following function(s) in a list of dates (ascending, obviously)
to

=VLOOKUP(DATE(YEAR(NOW())-5;MONTH(NOW());DAY(NOW()));$A:$A;1)

This gives me either today, or the last occurance of the same day 5 years
ago if today is not available. I know what causes this, but can anybody
give
me a not too complicated formula for getting the next one?

Thanks a lot!

Mike





  #5   Report Post  
Tsjah
 
Posts: n/a
Default

Whoops, I see we just passed along eachother, thanks a lot for your help
anyway!

Mike


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
How do I create a schedule from a list of dates ? Gavin Morris Charts and Charting in Excel 2 October 28th 10 04:08 PM
calculate no. of years between a date and today's date Sue Excel Worksheet Functions 10 June 14th 05 02:56 AM
calculate date differences in years and months Joyce Excel Worksheet Functions 1 March 14th 05 05:18 PM
Calculat years married or age of someone on today's date Chersie Excel Worksheet Functions 4 February 21st 05 07:11 PM
How do I set up a date cell to and 15 years in another cell? ldavis6 Excel Worksheet Functions 4 December 21st 04 04:03 PM


All times are GMT +1. The time now is 12:58 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"