Calculating the Nth weekday of a month.

Now in Calc with a less complicated formula:
https://drive.google.com/open?id=0B8X24IrD0EquMjYyUnRNWEZkb28

and the macro in calc:

https://drive.google.com/open?id=0B8X24IrD0EquTnY4UWR3Q2F4bWM

Kind regards,

Jan Flikweert

Hi,

Now calc function in one sheet without needless things:

https://drive.google.com/open?id=0B8X24IrD0EquNmhGaS1IUUN0VFE

Macro:

https://drive.google.com/open?id=0B8X24IrD0EquTnY4UWR3Q2F4bWM

Kind regards,

Jan Flikweert

=Not clear on formula.It seems to be more complex then mine, but does also
work a little differently. Yours does seem to give the 4th week instead of the
5th week, if it falls in the next month.

=IF(MONTH(DATE(Input.$A$2,1,1)-7+(Input.$C$2*7)-(WEEKDAY(DATE(Input.$A$2,1,1)))+Input.$B$2)1,DATE(Input.$A$2,1,1)-7+(Input.$C$2*7)-(WEEKDAY(DATE(Input.$A$2,1,1)))+Input.$B$2-7,DATE(Input.$A$2,1,1)+(Input.$C$2*7)-(WEEKDAY(DATE(Input.$A$2,1,1)))-7+Input.$B$2)
=DATE(Input.$A$2,$A2,1)+Input.$B$2-WEEKDAY(DATE(Input.$A$2,$A2,1))+((Input.$B$2WEEKDAY(DATE(Input.$A$2,$A2,1)))+(input.$C$2-1))*7

My two worksheets.

ftp://setzco.dyndns.org/libreoffice/nthweekday.ods</div>ftp://setzco.dyndns.org/libreoffice/simplenth.ods