Tables and indexes used in the formulas

The example illustrates the computations on a table that contains 9,000,000 rows:

The table has two indexes:

Different formulas are needed for allpages-locked and data-only-locked tables, since they have different amounts of overhead on the page and per row: