View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
cardan cardan is offline
external usenet poster
 
Posts: 112
Default Counting Specific Number of Days across Multiple Months

On Apr 14, 5:29 am, "Max" wrote:
Fwiw, the response below was posted to your multi-post in .links ..
(you should not multi-post)
--------
One approach to achieve it is illustrated in this sample construct:http://www.savefile.com/files/638369
Apportioning days within a date range under correct month cols.xls

Startdates in E3 down, Enddates in F3 down
1st of month dates (formatted as "mmm-yy") listed in L2 across, viz: Jan-07,
Feb-07, etc

Then in L3:
=IF(TEXT(L$2,"mmm-yy")=TEXT($E3,"mmm-yy"),DATE(YEAR(L$2),MONTH(L$2)+1,0)-$E*3+1,IF(TEXT(L$2,"mmm-yy")=TEXT($F3,"mmm-yy"),$F3-DATE(YEAR(L$2),MONTH(L$2),*1)+1,IF(AND(DATE(YEAR(L $2),MONTH(L$2),1)DATE(YEAR($E3),MONTH($E3),1),DAT E(*YEAR(L$2),MONTH(L$2),1)<DATE(YEAR($F3),MONTH($F 3),1)),DAY(DATE(YEAR(L$2),MO*NTH(L$2)+1,0)),"")))

Copy L3 across/fill down as far as required. This will return the number of
days under each month's col as appropriate (between the startdates and
enddates in cols E and F)
--
Max
Singaporehttp://savefile.com/projects/236895
xdemechanik
---


Thanks for the advice. I downloaded the spreadsheet that you linked
up. Thank you for that. It always helps when you can see the formulas
at work. Do you have to format the dates as "mmm-yy"" to work
properly? or can I put it my own date formatting (ie 4/23/2007) or
January 3, 2008? Thanks again.