Most pots are cylinders or are cylinder-ish, and there is a simple math equation to figure out the volume of a cylinder:
volume of cylinder= pi * radius squared * height
Let's break that down: you first figure out the area of a circle, which is pi (3.14) multiplied by the radius squared. Containers are generally sold by diameter - so an 18" pot is 18" diameter at the top, and it is that circle whose area we'll calculate. Most containers taper so that the bottom is smaller than the top, but for the sake of estimating, it's easiest to pretend your container is the same diameter throughout. The radius is half of the diameter, so the radius of an 18" pot is 9". That means the radius squared - 9" multiplied by 9" - is 81". We'll multiply that by pi, rounded to a convenient 3.14 which gives us 254.34 square inches - that's the area of the circle, or the surface, of the container.
Now we need to multiply that by the height of the container. Let's say that our 18" pot is 14" high:
254.34 square inches x 14 inches = 3560.76 cubic inches
When we multiplied by the height, we went from square inches to cubic inches, so the volume of our 18" wide, 14" high pot is 3560.76 cubic inches.
But potting mix isn't sold in cubic inches - it's sold in dry quarts or cubic feet. So we need to convert our result into a relevant number by dividing it by the number of cubic inches contained in one:
quart - 67.2 cubic inches per dry quart
or
cubic foot - 1728 cubic inches per cubic foot
(you can use this handy site to do the converting for you if you'd like)
So to fill one 18" wide, 14" high container, we'll need 52.98 quarts or 2.06 cubic feet of potting mix.
If you have a square or rectangular container, just find the area of the top surface by multiplying the length times the width, then multiply that result by the height of the container.
Add up the volumes of all the containers you need to fill to know how much potting mix you'll need to buy. Remember that estimates are on the generous side, especially for tapered containers, and that they don't allow for the space that the roots will take up or the 1-2" space you'll leave at the top for watering.
Or you can just fill until the container is full.