If you usually reach for coffee after an unrestful night, it may only get you so far.

Research from Michigan State University shows that caffeine can help with performing some tasks while offering little assistance in others.

The study was published in the Journal of Experimental Psychology: Learning, Memory, & Cognition.

Psychology associate professor Kimberly Fenn led a Sleep and Learning Lab research team. They evaluated the effectiveness of caffeine in counteracting sleep deprivation’s negative cognition effects. Researchers asked over 275 participants to complete a simple attention task and a more challenging “placekeeping” task. The latter required participants to complete tasks in a certain order without missing or repeating steps.

“We found that sleep deprivation impaired performance on both types of tasks and that having caffeine helped people successfully achieve the easier task. However, it had little effect on performance on the placekeeping task for most participants,” Fenn said in a press release. “Caffeine may improve the ability to stay awake and attend to a task, but it doesn’t do much to prevent the sort of procedural errors that can cause things like medical mistakes and car accidents.”

The American Sleep Association reported that 35.3% of adults say they get less than seven hours of sleep in a typical 24-hour period. Chronic sleep deprivation is linked to high blood pressure, heart failure, stroke, heart attack and diabetes, according to the Cleveland Clinic. Depression, obesity and immunity impairment are other possible issues.

“Caffeine increases energy, reduces sleepiness and can even improve mood, but it absolutely does not replace a full night of sleep, Fenn said. “Although people may feel as if they can combat sleep deprivation with caffeine, their performance on higher-level tasks will likely still be impaired. This is one of the reasons why sleep deprivation can be so dangerous.”