Do you ever wonder why doctors always tell you to eat a balanced diet? Say you love pineapple chicken, for example. Pineapples and chicken are both good for you, right? So why can’t you just live off pineapple chicken?

The reason is that the building blocks for good health come from a variety of foods, even if they are from the same family of nutrients. Such is the case with vitamin B, a key player in maintaining cell health and keeping you energized.

Not all types of vitamin B do the same thing. Additionally, the different types of vitamin B all come from different types of foods. Vitamin B-12, for example, is found primarily in meat and dairy products. B-7 and B-9 (and, to some degree, B-1 and B-2) are found in fruits and vegetables.

Deficiencies of any of these can lead to health problems. Sometimes a doctor will prescribe a supplement when they think you’re not getting enough vitamin B.

Certain groups, such as older adults and pregnant women, need larger amounts of some types of vitamin B. Certain conditions, such as Crohn’s disease, Celiac disease, HIV, and misuse of alcohol can result in poor absorption of vitamin B.

Symptoms of a deficiency depend on what type of vitamin B you lack. They can range from fatigue and confusion to anemia or a compromised immune system. Skin rashes also can occur.

Here’s a rundown of the most common types of vitamin B: what they do, which foods contain them, and why you need them.

Which foods contain it: Vitamin B-12 is found primarily in meat and dairy products, so anyone on a strict vegan diet is at risk for deficiency. The only other dietary sources of B-12 are fortified foods.

Some of the best sources of vitamin B-12 include:

eggs

cheese (one serving is the size of a domino)

a glass of milk (1 cup)

fish (a serving of any meat is the same size as a deck of cards)

shellfish

liver

kidney

red meat

Try this recipe for a brunch version of ratatouille. Eggs and cheese make it a great source of vitamin B-12.

What happens if you don’t get enough: Vitamin B-12 deficiencies can lead to anemia and confusion in older adults.

Psychological conditions such as dementia, paranoia, depression, and behavioral changes can result from a vitamin B-12 deficiency. Neurological damage sometimes cannot be reversed.

What it does:Vitamin B-6 (pyridoxine) helps the body turn food into energy. It can also help the body fight infections. Pregnant and breastfeeding women need it to help their babies’ brains develop normally.

What they do:Vitamin B-1 is also called thiamin, and Vitamin B-2 is also called riboflavin. These vitamins help convert food into energy. Vitamin B-1 has neurological benefits, and vitamin B-2 helps maintain proper eyesight.

Where you get them: Most people get thiamine from breakfast cereals and whole grains. Riboflavin can be found in:

Why you need them: Deficiencies in thiamine and riboflavin generally don’t pose a problem in the United States. This is due to the fact that many foods, such as milk and whole-grain cereals, are fortified with the vitamins. It can become an issue with people who misuse alcohol, however, presenting symptoms such as confusion and cracks along the sides of the mouth.

What it does: Vitamin B-9 is also called folate or folic acid. Folate is found naturally in foods. Folic acid is the synthetic form, often found in fortified, processed foods. Like most B vitamins, B-9 fosters the growth of red blood cells. It also reduces the risk of birth defects when consumed by pregnant women.

Why you need it: Without enough folate, a person can develop diarrhea or anemia. Pregnant women with a folate deficiency could give birth to babies with defects. Excessive supplemental folic acid during pregnancy, however, may also lead to neurological problems in the baby.

To stay healthy, most people don’t need to take a supplement in order to get enough B vitamins. There are plenty of delicious foods available to get all the nutrients you need naturally, as long as you maintain a complete diet of meats, grains, fruits, and vegetables.

Sometimes over-the-counter supplements are used to prevent deficiency. Vitamin supplements should only be taken under advice of a doctor. If you are pregnant or over the age of 50, you are more likely to need supplements.

Also, supplementation is only a last resort if you cannot obtain B vitamins through diet, or if you have certain health conditions that warrant their use. The risk of overdose is lower than other nutrients because B vitamins are water-soluble. However, supplements may still cause side effects or long-term health effects or interact with medications you take.

If you suspect you might be vitamin B-deficient, contact your doctor. They might order a physical exam as well as blood testing.