It depends on exactly where the planet is, how fast it is moving, and what direction it's moving in, and there is really no one simple formula. If it is far from both stars and moving at the right speed in a direction to go around them, then it can orbit them both. But it has to be so far away that the two stars together are always close together in the sky of the planet.
Cang Ye is correct that, if the planet is close enough to one star or the other, then it can orbit just that star. For instance, Neptune is so far away that, if it were replaced by a Sun-like star, then our orbit about our sun would barely be affected. There is a concept called the "Hill sphere" that tells roughly how close you have to be to one star or the other to have a stable orbit about just that star.
If it's moving really fast, it will leave the system entirely.
If it's moving slow enough, or heading in just the right direction, it will fall into one of the stars. Rarely, orbits can be really complicated, looping around one star and then the other. Such orbits tend to be chaotic and won't last long. The planet will either fall into a star or be ejected from the system.
Oh, if one star is much bigger than the other, so that the smaller star can be said to orbit around the bigger one, then there are the five Lagrange positions that the planet can occupy, although only two of them are stable.
This is a perfect example of what is called the three body problem in physics, and it's actually been proven that there is no formula that works for all starting positions. Generally computer simulations are used if the orbit is complicated or if you are trying to analyze far into the future.