jmw, yours is just a case of a missing 'output' for the first if function. Modify it as such:
=IF(A1>12,IF(A1<40,1,0),0)
Then both 11 and 41 return a 0, instead of <12 values returning FALSE. The first IF statement, if true, returns the second IF statement. But, if it's false then it doesn't...