Hi!
Since you're not using a full date format from either drop down you'll have
to create a little table so that you can generate a date. You'll see in the
final formula why this is necessary.
Create a list of the month names:
G1 = January
G2 = February
...
G12 = December
You may already have a list like this that you use as the source for month
drop down.
Select cells A15:A19 and give them a custom format of: dddd d.
Enter this formula in A15 and copy down to A19:
=IF(TEXT(DATE(B$1,MATCH(A$1,G$1:G$12,0),1+1*ROWS($1:1)*7)-WEEKDAY(DATE(B$1,MATCH(A$1,G$1:G$12,0),8-6)),"mmmm")=A$1,DATE(B$1,MATCH(A$1,G$1:G$12,0),1+1*ROWS($1:1)*7)-WEEKDAY(DATE(B$1,MATCH(A$1,G$1:G$12,0),8-6)),"")
Kinda ugly, ain't it?
We can shorten it a little by replacing the references to MATCH with a cell
reference. That's what you needed the table for. For example, use a cell to
hold the month number, say, cell C1:
=MATCH(A1,G1:G12,0)
Then you can refer to that cell instead of using the MATCH inside the DATE
function:
=IF(TEXT(DATE(B$1,C$1,1+1*ROWS($1:1)*7)-WEEKDAY(DATE(B$1,C$1,8-6)),"mmmm")=A$1,DATE(B$1,C$1,1+1*ROWS($1:1)*7)-WEEKDAY(DATE(B$1,C$1,8-6)),"")
Another way to do this would be to use 2 different formulas, one formula to
find the first Friday of the selected month/year in cell A15 and then in the
subsequent cells, A16:A19, have a differnt formula that adds 7, 14, 21 or 28
days (if needed).
I like the "one formula fits all" method, myself.
Biff
"murfitUK" <(E-Mail Removed)> wrote in message
news:8rNRf.1450$(E-Mail Removed)...
> Is this possible?
>
> I have two cells which are filled in by choosing from drop-down lists. A1
> is January, February etc and B1 is 2006, 2007 etc.
>
> Once the user chooses the month & year I would like Excel to automatically
> fill in some fields further down the sheet - showing the Friday dates in
> the month/year chosen.
>
> EG
>
> Choosing March 2007 would give:
> Friday 2
> Friday 9
> Friday 16
> Friday 23
> Friday 30
>
> or August 2006 would give:
> Friday 4
> Friday 11
> Friday 18
> Friday 25
> (and then a blank cell as only 4 Fridays in this month)
>
> I can type "Friday" in as text in eg A15-A19 and then use conditional
> formatting to hide the A19 Friday if there are only 4 Fridays in the
> month - I will do this by turning the font colour to white if B19 is
> empty. That's the easy part!
>
> But... Is there any formula to calculate the day numbers to go into
> B15-B19?
>
> All help/suggestion gratefully received.
>
> Thanks.
>