do command blocks have a range?
The command /execute if @p[distance=.. 2] will test to see if any players are within a range of 2 (the command block itself plus 2 more blocks in every direction). Range 2 is the range a player want for a command block under a floor.