We went throught the same thing with both of our kids. With the first kid, we added dark KARO syrup into every bottle that he took until he was off formula. That helped with him.
With our daughter, the KARO didn't do too much. She was and still has some issues. What we do with her is, put MIRALAX in her bottles. This is wonderful becasue you can control the consistancy of the bowel movement. Start with about 1/2-1tsp in maybe 2 bottles for a couple of days tp see how that works. If it's better, you can lessen or stop the miralax. If not stopped, add it to more of the bottles.
This has worked wonders for our daughter.