Solved

Number of specific dates or days between two dates

Posted on 2011-09-19
7
214 Views
Last Modified: 2012-05-12
Hi,

I need a formula that can work out how many dates or days are between two dates, i.e. how many FRI between 1/1/2011 and 10/6/2011 or how many 21st's are there between the dates etc
0
Comment
Question by:StormFusion
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 3

Accepted Solution

by:
lisa_mc earned 75 total points
ID: 36559418
hi

to find how many days eg monday or so on use

Number Of Mondays In Period

If you need to return the number of Monday's (or any other day) that occur within an interval between two dates, use the following Array Formula:

=SUM(IF(WEEKDAY(A2-1+ROW(INDIRECT("1:"&TRUNC(B2-A2)+1)))=C2,1,0))

This formula assumes the following:
A2 contains the beginning date of the interval
B2 contains the ending date of the interval
C2 contains the day-of-week number (1=Sunday, 2=Monday,...,7=Saturday)

examples from
http://www.cpearson.com/excel/datetimews.htm
0
 
LVL 3

Expert Comment

by:lisa_mc
ID: 36559424
and the link below will help you out with the second problem

http://www.cpearson.com/excel/DateIntervals.htm
0
 
LVL 50

Expert Comment

by:teylyn
ID: 36559442
Hello,

to work out the number of days between to dates you simply need to subtract the earlier date from the later date

Say A1 is 1/01/2011 and A2 is 1/04/2011 (April-1-2011)

=A2-A1

will return 90 (days).

As a rough guideline, you could divide that result by 7 too arrive at the number of Fridays or any other weekday as an average.

Your also ask about how many 21sts there are. This seems like quite a few requirements. What exactly do you want to return?

Can you post a workbook with some data and manually mocked up results?

cheers, teylyn
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:StormFusion
ID: 36559498
The first reply above works perfect for working out certain days between two dates, thats fine.

But I also need to work out for example... 1/1/2011 to 27//4/2011 and looking for 28th's, would give me a result of 3, because it would see 28/1/2011, 28/2/2011 and 28/3/2011 but not 28/4/2011 as the to date finishes on the 27th.
0
 
LVL 92

Assisted Solution

by:Patrick Matthews
Patrick Matthews earned 50 total points
ID: 36559741
Same basic approach should work to count the number of indicated days of the month:

Assuming that your day of the month is in D2...

{=SUM(IF(DAY(A2-1+ROW(INDIRECT("1:"&TRUNC(B2-A2)+1)))=D2,1,0))}

As before, that is an array formula.  To enter an array formula, do not enter the curly braces, and hit Ctrl+Shift+Enter instead of Enter to finish it off.  Excel will then display those braces to indicate that it's an array formula.
0
 

Author Comment

by:StormFusion
ID: 36562607
Lisa_mc thankyou for those, and mathewpartrick thanks, tried to change it to also count number of certain months between date by changing DAY to MONTH but didnt work?
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 36567674
StormFusion,

With respect, I think your original question has been answered.  If you want to tackle that months part, I suggest you create a new question for it.

Patrick
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now