Count number of specific days between dates

TheAntisocial

New Member
Joined
Sep 7, 2009
Messages
33
Office Version
  1. 2013
Platform
  1. Windows
Hi all.

I'm hoping you can help me with a formula to count the number of specific days between dates.

For example, i have two dates in two cells

A1 = 20/08/11
B1 = 20/09/11

I have a third column with a specific day

C1 = Monday

Is there a formula i can use to calculate how many "C1"s there were between "A1" and "B1"??

Any help is greatly appreciated :biggrin:

Thanks
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
If C1 is an actual text string "Monday"

Try

=SUMPRODUCT(--(TEXT(ROW(INDEX(A:A,A1):INDEX(A:A,A2)),"dddd")=A3))
 
Upvote 0

TiaXL

Board Regular
Joined
Jun 17, 2011
Messages
124
Hi all.

I'm hoping you can help me with a formula to count the number of specific days between dates.

For example, i have two dates in two cells

A1 = 20/08/11
B1 = 20/09/11

I have a third column with a specific day

C1 = Monday

Is there a formula i can use to calculate how many "C1"s there were between "A1" and "B1"??

Any help is greatly appreciated :biggrin:

Thanks

USE VBA


Code:
Sub test()
Dim dStart As Date
Dim dEnd As Date
Dim iDateCount As Integer
dStart = RANGE("A1").VALUE
dEnd = RANGE("B1").VALUE
 
Do Until dStart = dEnd
  dStart = dStart + 1
  If Weekday(dStart) = WEEKDAY(RANGE("C1")).VALUE Then
    iDateCount = 1
  End If
Loop
 
 RANGE("D1").VALUE = IDATECOUNT
End Sub
 
Upvote 0

TheAntisocial

New Member
Joined
Sep 7, 2009
Messages
33
Office Version
  1. 2013
Platform
  1. Windows
C1 is indeed a text string, and the formula works a treat!

Thanks for the help, very much appreciated :biggrin:
 
Upvote 0

Forum statistics

Threads
1,195,749
Messages
6,011,436
Members
441,614
Latest member
TiaGtz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top