Earl was on the 1 + 5 = <<1+5=6>>6th floor after going up 5 floors.
When he went down 2 floors, he was on the 6 - 2 = <<6-2=4>>4th floor.
Since he went up 7 floors, he was then on the 4 + 7 = <<4+7=11>>11th floor.
Since he is 9 floors away from the top of the building, therefore the building has 11 + 9 = <<11+9=20>>20 floors.
#### 20