You use the total yards on offense and defense for the team ranking. However, does "total yards" really reflect the real team ability?
We have to take more into consideration, for example, opponent's strength. Gaining 100 yards against Bears' defense shouldn't be viewed the same as 100 yards against Raiders' defense. Besides, the game circumstance is also important, for example, when you're leading by 20 points late in the game, you usually become conservative. Furthermore, touchdowns, turnovers, and drive success rate should all be considered when ranking team offense and defense.
Using a more advanced stas, DVOA, which take all of above into account, Bills' offense is ranked 24th and defense is 18th.