I find something like this formula easier to understand.
=SUMPRODUCT(--(TEXT(ROW(INDIRECT(DATE(2010,1,1)
&":"&DATE(2010,12,31))),"mmmddd")="FebWed"))
I'm sure that it's much slower than Biff's, but it's pretty straight forward.
The biggest thing is the =indirect() function. That just makes it so that excel
sees this string:
date(2010,1,1)&":"date(2010,12,31)
as a range of rows.
Date(2010,1,1) is just a number that's nicely formatted to excel. If you format
it as general, you'll see 40179 (with a base date of 1904).
=sumproduct() likes to work with numbers, so the -- stuff changes a bunch of
true/false's to 1's and 0's.
And if you put the start date in A1 and the end date in A2, the formula changes
to:
=SUMPRODUCT(--(TEXT(ROW(INDIRECT(a1&":"&a2)),"mmmddd")="FebWed"))
And if you wanted to count the number of days in that time interval, you'd
change the format and the string to look for:
=SUMPRODUCT(--(TEXT(ROW(INDIRECT(A1&":"&A2)),"ddd")="Wed"))