I am building a spreadsheet to help me quote decks. For a given deck size I know I need 6x6 posts every 8'. I know how to figure that for the perimeter but how do I calculate that for the interior posts? For example, a 8' x 8' free standing deck only needs 4 posts, one at each corner. But a 10' by 10' free standing deck needs one at each corner, plus one in the middle of each side, plus one in the middle (going with symetrical spacing), for a total of 9 posts.

Small evenly shaped decks like this are easy to figure in my head, but when I get into a large or non-square one (30 x 45 for example) a formula would be better.

Any ideas?