#### Formula to display Count of Days in given month, using list of Start and End Dates

```I have a large number of rows that contain a start date and end date.
I am attempting to generate a count of days within that date range
that are in a particular month, for example, Jan of 2011.

Any suggestions for a formula that could be used to display the
amounts shown in Column C would be helpful.

Layout is:

A                B                          C
Start Date   End Date      Count of Days in Jan2011
1/10/11       4/7/11                    21
2/6/11         3/1/11                    0
12/20/10      2/15/11                  31
Etc.

```
 0
4/7/2011 4:08:54 PM
excel 39879 articles. 2 followers.

2 Replies
341 Views

Similar Articles

[PageSpeed] 37

```Dave,

I think the best way is to create a table from Start Date to End Date
then use the Formula below each cell in the table =text(cell,"m") then
count  all 1

Cheerz!
~jaeson
```
 0
4/7/2011 9:23:07 PM
```On Thu, 7 Apr 2011 09:08:54 -0700 (PDT), Dave K <fred.sheriff@gmail.com> wrote:

>I have a large number of rows that contain a start date and end date.
>I am attempting to generate a count of days within that date range
>that are in a particular month, for example, Jan of 2011.
>
>Any suggestions for a formula that could be used to display the
>amounts shown in Column C would be helpful.
>
>Layout is:
>
>A                B                          C
>Start Date   End Date      Count of Days in Jan2011
>1/10/11       4/7/11                    21
>2/6/11         3/1/11                    0
>12/20/10      2/15/11                  31
>Etc.

To duplicate your results requires not counting the first date, otherwise your January count would be 22.  Is the 21 a mistake?  Or do you really want to omit the first day.

If the result for January should really be 22, then, with the first of the month in C1  (e.g. 1/1/2011, which you could custom format to show, for example Jan 2011)

C2:	=SUMPRODUCT((ROW(INDIRECT(StartDate&":"&EndDate))>=C\$1)*(ROW(INDIRECT(StartDate&":"&EndDate))<=EOMONTH(C\$1,0)))

and fill down as far as required.

Note that if you have other dates in row 1; so long as they are the first of the required month, you can also fill across to see the number of days in other months.

If you really don't want to count the first day, then change the references to StartDate to StartDate+1.

If you get a #NAME! error, and you are using a version of excel prior to 2007, check HELP for the EOMONTH function for instructions on installing the Analysis Tool Pak.

If you are using a version prior to Excel 2007, and cannot install the ATP, then use this formula instead:

C2:	=SUMPRODUCT((ROW(INDIRECT(StartDate&":"&EndDate))>=C\$1)*(ROW(INDIRECT(StartDate&":"&EndDate))<=DATE(YEAR(C\$1),MONTH(C\$1)+1,0)))
```
 0
ron6368 (329)
4/8/2011 12:54:20 AM

Similar Artilces:

if cell starts with characters formula
Hi I need to count cells in a column starting with certain characters. each cell's data varies in length. I have tried with @countif( but does not work if the cell contains other characters after the "prefix". eg. row 20 cell 5 apples row 21 cell 5 apples red row 22 cell 5 apples green row 23 cell 5 plums green row 23 cell 5 plums purple totals required for apples = 3 (regardless of colour) total required for plums = 2 (regardless of colour) @countif(C20:c30,"plums") gives answer of 1 require answer of 2 @countif(C20:c30,&quo...

Using expression builder object
Hi, I'm developing a wizzard in Access which builds import templates for various data sources to a fixed set of tables. In step 3 the users must be able to build an expression ; for instance Left([Fieldx],20) . Now I would like to have a command button on my form which calls the Access expression builder to allow the users to use this to build the expression. This expression will then be stored in a text box linked to the templates table. Anybody know how to call and use this object from VBA code? -- Kind regards Noëlla DoCmd.RunCommand acCmdInvokeBuilder I th...

Counting number of X's in a column
I need to sum up the number of "Xs" in a column. I would be extremely grateful if someone could help me with the formula. I cannot seem to get one to work. We are using Excel 2003. Thank you. -- Susie Harris Operations Manager Environmental Education Association of Washington =COUNTIF(A:A,"X") -- HTH RP (remove nothere from the email address if mailing direct) "Susie Harris" <SusieHarris@discussions.microsoft.com> wrote in message news:FFA0FB17-C922-48A8-B3C3-0D487C1E6F6A@microsoft.com... > I need to sum up the number of "Xs" in a col...

Sir, My ISP rpovide me a free time to use internet conection between 2.00 amto 8.00 am. My ISP charges me on the maount of data send / receive by me on MB basis. So, is any way that the MS profesionsl edition 2003 (outlook) starts on 2.01 am, starts downloding / sending the mails from POP accounts. and stop at 7.59 am. Is any trick available , please let me and other esteem members of this group know. thanks in advance. Schedule a task (in Win), ie to start OL (I assume you will have configured OL for polling) Then schedule a shutdown/close of OL "Prince" <r.r.makwana@gmai...

Using part of a cell in a chart title
I have a chart which should get a title. However, this should be partly be used from a cell e.g. "counted with 5%" 5% should be taken from the cell and used in the title. Is this possible? Hi, Yes it's possible but all of the chart title needs to be in the cell. So you may need to use a helper cell and concatenate text and value. http://www.andypope.info/tips/tip001.htm Cheers Andy -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "Nicole" <Nicole@discussions.microsoft.com> wrote in message news:5CB7A971-AA7F-4C34-BB42-7DC283AA2958@micro...

Create a distribution list from addresses in the 'To' list
Hi all, I belong to a social group, and our co-ordinator sends out an email from time to time with all the latest addresses in the To list. I already have a distribution list for the group, which then needs to be checked through and updated. Is there a simple way of transferring those addresses into my own distribution list? I'm using Outlook 2002. Everybody's fiddling around with bits of paper - I'll be a hero if I can make it easy for them! Thanks. Astley http://www.outlook-tips.net/archives/2004/20041105.htm -- Russ Valentine [MVP-Outlook] "Astley" <ast@...

Planned Open Market Days
A spreadsheet named "NYSE Holidays" contains NYSE Planned Holidays for 2005 and 2006; containing data in columns A and B: New Year's Day 01/01/05 Martin Luther King, Jr. Day 01/17/05 Washington's Birthday 02/21/05 Good Friday 03/25/05 Memorial Day 05/30/05 Independence Day 07/04/05 Labor Day 09/05/05 Thanksgiving Day 11/24/05 Christmas 12/26/05 New Year's Day 01/02/06 Martin Luther King, Jr. Day 01/16/06 Washington's Birthday 02/20/06 Good Friday 04/14/06 Memorial Day 05/29/06 Independence Day 07/04/06 Labor Day 09/04/06 Thanksgiving Day 11/23/06 Christmas 12/25/06 ...

what's the formula for adding symbols in cells?
I have a chart that has blank info in the legend. I want to add an * to indicate something, but just inserting a symbol doesn't work. Any ideas? Thanks. Debi - To add information to the legend, you need to add to a series name. Right click on the chart, select Source Data from the pop up menu, click on the series tab, select a series, and either type something in the name box, or click in it and select a cell with the mouse. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services http://PeltierTech.com/Excel/Charts/ _______ Debi wrote: > I have a chart tha...

formula based on format
Is there a way to have a formula that is based on a cell colour or based on the way a cell is formated? I need it to count the number of occurrences that this happens. -- Thank you for your time. Windows NT Office 97 Hi you'll need VBA. See for an example: http://cpearson.com/excel/colors.htm "James Kendall" wrote: > Is there a way to have a formula that is based on a cell colour or based on > the way a cell is formated? I need it to count the number of occurrences > that this happens. > -- > Thank you for your time. > Windows NT > Office 97 This ...

Hello, Is there a way to display at runtime the property menu of a control so that the user may interact with the control? In my case, I'm speaking about the MsChart control which has a property menu at the design phase (when picking "properties" after right clicking on the control) Thanks Avi "avi" <aviben@bezeqint.net.il> wrote in message news:e2fc8178-471a-48b1-9671-fc81ca23c912@l14g2000yql.googlegroups.com... > Is there a way to display at runtime the property menu of a control so > that the user may interact with the control? > ...

How do I use traffic lights in excel
I am wanting to use traffic lights in excel that change colour based on the result of a variance cell, ie if the result of the cell is 10 make the traffic light green, if it is 20 make the traffic light amber, if the result is 30 make the traffic light red. How do I do this? Shorty Format>Conditional Formatting>Cell Value is: Note: you can add up to 3 conditions(4 if you count default) Gord Dibben Excel MVP On Wed, 22 Dec 2004 16:35:03 -0800, Shorty <Shorty@discussions.microsoft.com> wrote: >I am wanting to use traffic lights in excel that change colour based on the &g...

Filter recordset using query results
Hi all I have a form based on a query called [qry Quarterly Planning], it lists all Itineraries on the system. On this form you can filter records by specifying a Start and End Date for the [ReviewDate] and/or [Specialist]. It is a subform on a main unbound form, lets call this Subform1. Along side this I have another subform (Subform2) which displays ReviewDates that exist against an Itinerary. In other words Subform1 has a start date of an activity and if the activity lasts longer than 1 day, then the additional dates are stored in Subform2 (ItineraryDates). Currently when I...

How to change font size on formula bar in Excell 2007
I don't find Tools>Options>General (as suggested in other post answers) in Excel 2007. On the Office button there is an Excel Options but it doesn't provide a method of changing font size on the office but. My font is so small I can barely see it. Office button>ExcelOptions>Popular tab>in the "When creating new workbooks" section, choose font and font size -- Kind regards, Niek Otten Microsoft MVP - Excel "jimwillie" <jimwillie@discussions.microsoft.com> wrote in message news:588AAC05-0F52-404E-AA01-128E70E02D0B@microso...

How do I create several NEW templates from start to finish please?
Hi knowledgeable people. I am looking for instructions on how to create a range of basic templates that I can use, perhaps even by selecting them as 'stationery', for example; if I go to >New >Format >Apply stationery, or any other similar method. I can create new html stationery backgrounds, but this is NOT what I am looking for, as a lot of people still read email in plain text only...does this make sense? Plain text templates would be fine. I simply can't find any info on creating email templates anywhere to suit this Windows Live Mail Desktop versio...

cant start outlook pst file to large
Hi I hope somebody may be able to help im new to outlook and now I cant start outlook message says cannot open your default email folders pst file its too large as I cannot open outlook I cannot delete old folders See if this helps: http://support.microsoft.com/kb/296088 -- -Ben- Ben M. Schorr, MVP Roland Schorr & Tower http://www.rolandschorr.com http://www.officeforlawyers.com/outlook.html Author: The Lawyer's Guide to Microsoft Outlook 2007: http://tinyurl.com/ol4law-amazon "Ray" <Ray@discussions.microsoft.com> wrote in message news:B3B824DC-3C9B-4B1B-8EF3-61...

displaying colors in an mfc application
Hi everyone, I'm working on an MFC application. The application is a treeview in which are represented some objects (persons, roles....). I have declared some bitmaps in the visual project to represent these objects. My problem is that some colors of the bitmaps are not displayed. I guess there is a palette problem or something like that. Does anybody have an idea of what the problem is? Thanks a lot for your help.... Fred Try using ILC_COLOR24 | ILC_MASK when you create your imagelist. -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "fred" <fred@laposte.net> wrot...

Using Visio HTML output within frames
Hi, I want to include visio HTML output in a frame of another html file. Unfortunately it is not working. I understood the problem is in vml_*.htm files. It is due to, the target arrtibute(pointing to _parent) in v:shapetype tag and href attribute (pointing to #) in v:shape tag. These attributes should point to "_top" and "<target-html-file>#" respectively inorder to work. I want to change these options while saving .vsd as web page? I would appreciate if you can help me in this regard. <v:shapetype id="VISSHAPE" target="_parent" coor...

dates #5
Is there a formula to ad a numeric value to the name of a month. I am running a query in excel (pulling from an external source) and would like to sort as teh table refreshes by month and year. I have code to to do the refresh and the sort, but it sorts in alphabetical order. I was thinking a formula could place a numeric value to the month (1 = Jan, 2 = Feb, etc) and I can sort based on that. Is there an easy formula to do this. Thanks in advance Your easy formula could be: =MATCH(A1,{"Jan","Feb","Mar","Apr","May","Jun"...

outputting values to a range from one formula
I wish to generate a table automatically by means of a single formula that applies an iteration on a starting given value with a given step, and the computed values are posted/entered automtically into cells from a given cell onwards, say below it, until the computed value reaches a certain given limt. This is somehow the inverse of INDIRECT or of OFFSET. These can pull values from a variable addresses of cells. What I need is to push values into a variable addresses of cells. Can anyone help me on that?? Thanks. :confused -- Shafe ---------------------------------------------------------...

This formula doesn't work: = day(today())
This formula doesn't work: = day(today()) Except from spreading one formula into 2, is it possible to make it workable in 1 formula? If so, how? -- Additional information: - I'm using Office XP - I'm using Windows XP ���H����O�D�`����. �p��������B, ���Ѫ̤��[�祿!! My ability is very limited. Hope you will not mind to enlighten me if I do wrongly. What doesn't work? For today (7 May 2004) =DAY(TODAY()) returns 7. In article <eYuAXhDNEHA.624@TK2MSFTNGP11.phx.gbl>, "0-0 Wai Wai ^-^" <x@x.com> wrote: > This formula doesn't work: = day...

Convert date
How can I convert a date in this format (mm-dd-yyyy) to a Julian-date (i.e., YYYYDDD)? For example: 09-13-2003 to 2003256 Hi see: http://www.cpearson.com/excel/jdates.htm -- Regards Frank Kabel Frankfurt, Germany gary wrote: > How can I convert a date in this format (mm-dd-yyyy) to a > Julian-date (i.e., YYYYDDD)? > > For example: 09-13-2003 to 2003256 On Wed, 8 Sep 2004 10:24:57 -0700, "gary" <anonymous@discussions.microsoft.com> wrote: >How can I convert a date in this format (mm-dd-yyyy) to a >Julian-date (i.e., YYYYDDD)? > >For exa...

formating date from general2 custom
I have an input xls file with the date but like this: Wed May 14 00:00:00 GMT-05:00 2008 I need to have just following format dd/mm/yyyy I tried to format it using Format->Cells->Date or Format->Cells- >Custom but this is failing. Nothing changed. Any ideas? Thanks for the help. Vlad <vladimir.vaynshtok@gmail.com> wrote in message news:1013b138-352b-4799-81ba-9508b74a1850@t54g2000hsg.googlegroups.com... >I have an input xls file with the date but like this: > > Wed May 14 00:00:00 GMT-05:00 2008 > > I need to have just following format > > d...

Font dosen't revert back to original after typing in date
Example I n my text I type I have December 28th The th automatically reduces to a much smaller font and once you hit the sapce bar to continue it reverts back to the larger font. It only does this some of times, why is this being so inconsistent?. I refortmated my comp. last week and when I reinstalled office I was hoping this inconsistent problem would have been resloved, but no 2nd question please. When I post a question in "discussion group" and check the box "Notify me of Replies" I never receice a reply to my question I then have to go back to ...

Newbie Question: Using Web Services
Hello All. I've been trying to implement Infopath with CRM with no success. I've tried the example, http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmbscrm1_2/html/mbs_crminfopathcrmintegration.asp, to no avail. I have followed the example to the letter, but find the information about publishing the Web Service to the server to be somewhat lacking. Admittedly, I am not a programmer, and I am continually running into an error in line 54: xmlDoc.LoadXml(objQuery.ExecuteQuery(objBizUser.WhoAmI(), strAllAccountsFetchXML)); Has anyone else ...

Sum column values that contains text &/or dates
Column D3 thru D43 contain a mixture of values & dates. For example: D3 = 16,026.76 D4 = 11-18-05 D5 = blank D6 = 6,855.34 D7= 11-03-05 D8 = blank D9 = 5,270.00 D10 = 11-02-05 Need sum to equal 28,152.10 (total only values from entry or formulas) Thanks so much. mikeburg -- mikeburg ------------------------------------------------------------------------ mikeburg's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=24581 View this thread: http://www.excelforum.com/showthread.php?threadid=489114 If your dates are text strings which say "11-18-05"...