The formula =MATCH(DATE(B2,B1,1),A1:A100,-1) works very

well except when the date (date(b2,b1,1) does not exist

in the range a1:a100. In that case it gives me the position

of the last row with data (A100).

No. It gives the position of the earliest date greater than or equal

to DATE(B2,B1,1). That will be the last position only if

DATE(B2,B1,1) is earlier than the last date in the range. It will be

#N/A if DATE(B2,B1,1) is later (more recent) than the first date in

the range.

Is there a way to modify the formula to get in those cases

#N/A or a text "Don't exist" ??

You question is unclear.

If you simply want "doesn't exist" if the month/year in B1:B2 is

earlier than the last month/year represented in A1:A100, then:

=IF(DATE(B2,B1,1)<A100-DAY(A100), "doesn't exist",

MATCH(DATE(B2,B1,1),A1:A100,-1))

If you also want "doesn't exist" if B1:B2 is later (more recent) than

the first month/year represented in A1:A100, then:

=IF(OR(DATE(B2,B1,1)<A100-DAY(A100),DATE(B2,B1,0)>A1-DAY(A1)),

"doesn't exist", MATCH(DATE(B2,B1,1),A1:A100,-1))

or for XL2007 and later:

=IF(DATE(B2,B1,1)<A100-DAY(A100), "doesn't exist",

IFERROR(MATCH(DATE(B2,B1,1),A1:A100,-1), "doesn't exist"))

However, if you also want "doesn't exist" there are month/years not

represented in the middle of A1:A100, then:

=IF(SUMPRODUCT(--(DATE(B2,B1,0)=A1:A100-DAY(A1:A100))),

MATCH(DATE(B2,B1,1),A1:A100,-1), "doesn't exist")