View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions,microsoft.public.excel.programming
smartin smartin is offline
external usenet poster
 
Posts: 915
Default Update a date into the same cell?

Greg L wrote:
OK, I think I've got it and after I thought about it, I don't think
the leap year matters. It's 364 days no matter what.

=MOD(DATE(2009,2,26)-TODAY(),364)+TODAY()

Anyone think this will not work? It seems to so far.

Thanks for all the help :)


You are correct, sir, on all accounts. Especially the observation that
the rule is 364 day increments regardless of leap days.

While you were working, I was also working on these ridiculous (but
effective formulae). I share them with some shame for having overlooked
the simple solution:

Looking forward five years or so:
=364*MATCH(A2-1,{0,1,2,3,4,5}*364+$E$1,1)+$E$1

{array formula, more generalized:}
=364*MATCH(A2-1,(ROW(INDIRECT("1:99"))-1)*364+$E$1,1)+$E$1

where A2 has "today" and E1 has the paydate to check.

Yet your solution is superior, for being simpler, and that it does not
require knowledge of an older paydate relative to today.

Good job!