Zend certified PHP/Magento developer

Excel matching two columns from two files with conditions

I have two sheets; let’s call S1 and S2

S1 looks like this

ID.  Age
0.   17
1.   18
2.   15
3.   12
4.   13

S2 looks like this

ID. 
0. 
2.  
4. 

So S2 has some missing IDs

Now; what I want to do is that

(1) adding one more column in S2 called “ages > 14”

ID.  Ages>14

(2) Then, I look the IDs in S1 that also appeared in S2; and check its corresponding ages in S1; if the age > 14; then in S2 second column, I put True; else False

So S2 should look like this

ID. Ages>14
0.   True
2.   True
4.   False

Is there any general formula ?

I’m also interested in the formula that deal with more than just numerical (like age here) but also string

such as False for S2 second column if its corresponding ID in S1 second column contains string “NOT”. etc

I believe these can be done in a more general formula right?