If you type a formula like this into an empty cell:
=len(a1)
(change A1 to the cell's address that contains the yyyy mm)
What's returned?
If you type this formula that empty cell:
=code(mid(a1,5,1))
what do you see?
If you don't see 7 for the first formula and 32 for the second, then the value
in that cell isn't what I thought it would be--plain old text like 2007 08
Any correct formula will need to know what you really have in those cells.