View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Glenn Glenn is offline
external usenet poster
 
Posts: 1,240
Default Calculate Days Left in Current Year

Dave C wrote:
I need to perform a calculation that returns the number of days that remain
in the current year from a variable date entered into a cell. I could enter
the last day of the year - 31/12/XX - into another cell but this would
require the user to update that value when the year changed. Can I base the
value of the (end of year) cell on a formula so the year changes
automatically when 31 Dec becomes 1 Jan - ie: change from 31/12/08 to
31/12/09 - or is there a formula where I can obtain the number of days
remaining in the current year based on the value entered into the variable
cell?

Thanks for any suggestions /solutions

Dave



With your "variable date" entered in A1:

=DATE(YEAR(A1)+1,1,1)-A1

So, for December 31st, the result would be 1. If you want the result to be 0,
change the formula to the following:

=DATE(YEAR(A1)+1,1,0)-A1