In whatever walk of life we’re trying to reach an achievement in, it can really hurt when you come up short. Whether you want to land that promotion or set a new personal best in fitness, you probably know that feeling of not getting quite what you want. Some people beat themselves up for an extended period of time after failure, but no matter what your emotional response, feeling that pain can actually lead to improvement in the future.

We’ve been told not to look back on the past and try to find mistakes, but research from multiple universities says otherwise. Study co-author Selin Malkoc said that “All the advice tells you not to dwell on your mistakes, to not feel bad. But we found the opposite. When faced with a failure, it is better to focus on one’s emotions – when people concentrate on how bad they feel and how they don’t want to experience these feelings again, they are more likely to try harder next time.”

In the study, researchers came up with three experiments, asking college students to participate in specific tasks. In the first experiment, students were told that there would be a $50 cash prize if they went on the internet and searched for the lowest price for a blender. What the students didn’t know was that the results were rigged, and no matter what price they came up with, researchers told them that the actual lowest price was $3.27 lower than the students’ lowest price.

After finding out that they wouldn’t be receiving the cash prize, the students were asked for their emotional response, and certain ones were asked to focus on those emotions, while others were asked to focus on more data-driven thoughts, analyzing what they could do better next time. For the next task, the students were asked to perform a very similar task, and the study found that the students who focused more on their emotions were more likely to perform better on that task. Overall, the students asked to focus on emotions spent 25 percent more time attempting to achieve their next task.

Noelle Nelson of the Kansas University School of Business said that “I do think people will be surprised that allowing themselves to feel bad about a failure can improve performance more than thinking about the failure in some instances. The kinds of thoughts – like rationalizing a failure – people tend to come up with are sometimes counterproductive.” Not wanting to feel that type of failure again was a driving motivator.

Nelson added that “In this case, I see our findings being useful to consumers themselves, employers, teachers or anyone who deals with managing failure in decision making. Someone like a manager or teacher would be able to guide employees and students in how they respond to failure, hopefully improving the way the next decision is made.” Nelson did not, though, that the future success is more likely if the next task is something similar to the previous one.

Melkic said that “When the participants focused on how bad they felt about failing the first time, they tried harder than others when they had a similar opportunity, but the situation has to be similar enough to trigger the pain of the initial failure.” During the study, many of the feelings that the students had actually turned out to be self-protective, saying that it wasn’t their fault or that it was impossible to achieve better results, while the amount of students who thought they could do better was fairly low.

So if you find yourself feeling down after not getting what you wanted in terms of success, make sure to capture that emotion and try not to ignore it. “A natural tendency after failure is sometimes to suppress emotions and cognitively rationalize the failure, but if people know the possible negative effects of that behavior, they can override that natural tendency and focus on the negative feelings,” Nelson said. “That should lead to learning and future decision making that is more positive.”

In the end, Melkic says that “If your thoughts are all about how to distance yourself from the failure, you’re not going to learn from your mistakes…Emotional responses to failure can hurt. They can make you feel bad. That’s why people often choose to think self-protective thoughts after they make mistakes. But if you focus on how bad you feel, you’re going to work harder to find a solution and make sure you don’t make that same mistake again.”