Depends on the tank (footprint not gallons), design (flat, sloped, lots of hardscape taking up space, etc) and what you're planning to grow/approx desired depth.
Some substrates give you cubic inches per bag, those are easy. Multiply width x length of your tank x average desired depth and you've got your cubic inches needed. Divide total needed by amt per bag and you've got your bag count.
When the product only supplies weight, not cubic, and it's available in a nearby store--I head over with a ruler and smooth said bag out on the floor and take it's actual measurements: width x length x actual height.
Example: 20x40 tank with average depth of 4"= 3,200 cubic inches. If each bag is 300 cubic inches then 3200/300=10.6 bags. If you've got major piece of hardscape that might offset the total--say, a whomping huge rock that'll be set directly on the tank bottom--measure its base, multiply by your depth and subtract that estimated cubic from your total.