Though there may be some point in time when scientists finally crack the humor code and come up with an exact formula for how to be funny, this is an intellectual challenge that has yet to be conquered as of 2014. There is no universally accepted way to be funny, and while some people are considered funnier than others in certain contexts, there's no real way to codify why that is or explain specific details of those individuals' success. There are certain broad areas, such as slapstick and other physical comedy bits, that can be identified as generally funny, but a pie-in-the face routine isn't likely to garner many laughs in a somber situation such as a funeral.
Some theorists have come up with broad explanations of why people use humor, and that might be the closest thing researchers have to a formula for comedy. Sigmund Freud, for example, saw humor as a tool of emotional release and relief. But that doesn't really help a person who wants an "a + b = c" type instruction manual for making a joke. The fact that subjective perception of humor depends on so many different changing factors may mean that humans will never really be able to come up with a single formula for funny.