What causes excessive flatulence and what can be done about it?

Food/flora/genetics. Combination of types of food, the way your body digests food, and the types of bacteria found in your bowels may affect flatulence. You can try active yogurt and or meds like gas-x for relief.
Swallowed air/ diet. The digestive system is an elaborate tube from the mouth to the anus. All people swallow air when they eat & some take in more than others. You either belch it up or create flatus. If you eat foods that your body doesn't digest completely, the germs in your gut will & they create flatus in the process. Keep a food diary & keep track of what makes you gassy & avoid them.