View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
Brad Brad is offline
external usenet poster
 
Posts: 846
Default calculate number of days

One small change on the second method
=Q22-P22-MAX(0,(Q22-DATE(2009,2,1)))-(DATE(2009,1,1)-P22)
sb
=Q22-P22-MAX(0,(Q22-DATE(2009,2,1)))-max(0,(DATE(2009,1,1)-P22))
--
Wag more, bark less


"Brad" wrote:

Just a subtle change from what has been suggested

=MIN(c2,(DATE(YEAR(c2),1+1,0)))-MAX(b2,DATE(YEAR(b2)+(MONTH(b2)1),1,1))+1

Another way that could be used
=Q22-P22-MAX(0,(Q22-DATE(2009,2,1)))-(DATE(2009,1,1)-P22)

This assumes that all dates are within 12 months of each oother
--
Wag more, bark less


"Bazy2k" wrote:

Hi guys.

Ok i have items that run between two dates, each month i have to calculate
how many days in that month relate to that item, eg. in Jan

Item From To Jan Days

a3 14/11/08 16/02/09 x
a4 19/12/08 09/01/09 x

So x = 31
x = 9

Is there a quick way to produce the number of jan days for each item between
the two dates using a formula? Maybe linked to a date of 31/01/09? and then
when i change the date to feb (28/02/09) the number of feb days are shown?
I have a long list of items you see and want to make the process faster!
Thanks!