Trial and error. We had her on Gerber Sensitive, it made her sick. Then we tried a Similac preemie that we thought might be better. It wasn't. So then we tried Similac Sensitive for Fussiness and Gas, and it's been working great. It's a soy type of formula. Your baby might just have a delicate tummy with the full milk formulas. Soy is supposed to help alot. Smells nasty, though, lol.
My daughter kept throwing up all of her food quite a bit. Turns out it was the formula we had her on. We tried 4 different types before we found one that actually works.