Try this...

Main date range:
D1: start date....eg Mar 01, 2010
E1: end date......eg Oct 31, 2010

Test date range:
A1: start date....eg Aug 21, 2010
B1: end date......eg Oct 21, 2010

This formula returns the number of days from the Test date range
that occur within the Main date range, inclusive:
F1: =MAX(MIN(B1,E1)+1-MAX(A1,D1),0)

In the above example, the formula returns :62

Is that something you can work with?