It can be tempting to buy a bunch of supplements from the drugstore, but that may be a mistake.

You may not need a lot of nutritional help, especially if you eat a healthy, varied diet. Supplements “are intended to fill gaps when adequate nutrients are not obtained through food alone,” says Reema Kanda, registered clinical dietitian at Hoag Orthopedic Institute in Irvine, California.

In most cases, if you need a supplement you should hear it first from your primary care doctor. You also should get a specific recommendation from your doctor on the type, dosage and brand of the supplement he or she wants you to take. The Food and Drug Administration doesn't regulate supplements, so choosing one willy-nilly can carry some serious health risks. However, there are certain people who can stand to benefit from them.

Here’s who might need to take supplements and when:

People who follow restricted diets
It’s not easy being green — or eating green. Vegans and other vegetarians often focus on eating iron-rich greens such as spinach and kale to get what they can’t from meat, but other nutrients typically found in animal sources, such as vitamin B-12, may fall by the wayside.

And people with other types of restricted diets could benefit from a multivitamin.

“Most of us would benefit from taking a daily multivitamin, particularly if our eating patterns are sporadic or if we tend to eat the same foods frequently,” says Dr. Julie Ellner, a weight loss specialist in San Diego. People who are trying to lose weight typically fall into that category, Ellner says.

If you start getting headaches or nausea, or have other symptoms after starting a restricted diet, speak with a dietitian about improving your nutrition.

Folic acid for women during childbearing years
Women who are pregnant or breastfeeding or who may become pregnant soon should take folic acid or a prenatal supplement, according to the National Institutes of Health. If taking folic acid alone, pregnant women should also take a multivitamin, Kanda says.

Folic acid, or folate when it is found in food, is especially important for fetal and infant development. Low levels can cause tubal birth defects, such as spina bifida and cleft palate.

Also known as vitamin B9, folate is found naturally in leafy greens, okra, lentils and asparagus. By law, food manufacturers also use folic acid to fortify cereals, bread, cookies and many other items made with enriched wheat flour, so most people don’t need a supplement.

Women over 50 often need calcium
As we age, our bones lose calcium and become more brittle. Older women are at the highest risk for osteoporosis, which can increase their odds of bone fractures.

That’s why doctors recommend that women over 50 or who are postmenopausal take daily calcium supplements.

When (and where) you might need a little extra D
Vitamin D is important for strong bones and a strong immune system. Doctors also recommend that women who are pregnant or lactating take extra vitamin D. Vitamin D helps your body absorb calcium, so if you’re taking both, take them together.

Others who might need vitamin D supplementation are those who don’t get it naturally from the sun. If you don’t leave the house often, live in a place with very little sunshine or have dark skin, you might want to supplement.

“I discover vitamin D deficiencies in the vast majority of patients,” says Ellner, who suggests getting your levels checked when you go to your doctor.

Be supplement smart
Supplements are a way to correct a minor nutrient deficiency, not an insurance plan for a poor diet. If you have a serious nutritional deficiency, your doctor can diagnose it and prescribe a supplement to you, in which case you may be able to get your health insurance to pay for it.

More From NerdWallet

Ellner notes that over-the-counter supplements don’t have to be approved by the Food and Drug Administration, so manufacturers can make any claims they want on the labels. Be wary of any miracle pill claims you see on packages, especially on herbal products that are not normally a part of a healthy diet. Avoid pills that promise you rapid or amazing results.

And remember that taking too many supplements can be harmful. “More is not better,” says Kanda, who warns to check with your doctor before starting a supplement, especially if you take a medication. “There could be drug interactions that could even be life-threatening.”