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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
If C1 is an actual text string "Monday"

Try

=SUMPRODUCT(--(TEXT(ROW(INDEX(A:A,A1):INDEX(A:A,A2)),"dddd")=A3))
 
Upvote 0
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
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,224,803
Messages
6,181,055
Members
453,014
Latest member
Chris258

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
Back
Top