How many gallons of water does it take to fill a 24-foot by 4-foot swimming pool?

The basic formula to figure water volume or gallons of water for a specific size say 20 x 40 are as follows 20 x 40 = 800 x average depth(say 5') = 4000 x 7.5(gallons per cubic foot) = 30,000

In answer to your question you did not give enough information. Is it 24ft diameter? If so the formula is radius squared x 3.14 x 4(average depth) x 7.5 Or 12 squared(144) x 3.14(452.16) x 4(a.d.)1808.64 x 7.5 = 13,564.8 gallons