How to check if there is any missing and replace

I have a dataset covering a number of companies for which there is a variable for the firms employees. Some years the number of employees has not been reported, hence a some years appear blank while the year before and after contains a value. The data is similar to:

COMPANY     YEAR       NO. EMPLOYEES 
Company 1   2007       4
Company 1   2008       5
Company 1   2009       5
Company 1   2010       5
Company 2   2007       11 
Company 2   2008       10 
Company 2   2009   
Company 2   2010       10 
Company 3   2007       3 
Company 3   2008       4 
Company 3   2009   
Company 3   2010       3 

I would like to be able to search the dataset for any such occurrences, making an indicator of these years, and afterwards replace any blank spots with the year before. If there is no previous year to use as a replacement or the previous year is blank, the year after the blank spot. I am hoping for the dataset to like:

COMPANY     YEAR       NO. EMPLOYEES 
Company 1   2007       4
Company 1   2008       5
Company 1   2009       5
Company 1   2010       5
Company 2   2007       11 
Company 2   2008       10 
Company 2   2009       10
Company 2   2010       10 
Company 3   2007       3 
Company 3   2008       4 
Company 3   2009       4
Company 3   2010       3 

To sum up, at first i need to check whether or not i do have a problem with missing values in-between two years (important that the codes do not replace missing values before or after the last year with a non-missing value, since som firms exit the sample). Next, if any blank years in between any two years that are non-blank, I would like to replace these blank spots as mentioned above.