The Hangover's success in 2009 resulted in two sequels in 2011 and 2013, as The Office continued without Steve Carrell in fall 2011
Each product we feature has been independently selected and reviewed by our editorial team. If you make a purchase using the links included, we may earn commission.

Ed Helms‘ starring role in the Hangover movies may have played into his season eight promotion on The Office.

In the upcoming book The Office: The Untold Story of the Greatest Sitcom of the 2000s by Andy Greene, never-before-seen interviews with stars and crew members shed light on the behind-the-scenes inner workings of the hit NBC comedy.

One of the topics discussed in the book, excerpted in Rolling Stone, is how the powers that be chose to make Andy Bernard (played by Helms) the new regional manager of Dunder Mifflin after Steve Carrell (who played lead character Michael Scott) exited the show.

The other major frontrunner for the promotion was fan-favorite Dwight K. Schrute, played by Rainn Wilson.

“The writers and the cast, generally speaking, were really excited about Dwight becoming the boss. It just felt correct, and that was our creative thrust,” writer Brent Forrester says in the book. “Mostly it was pushback from the network saying, ‘Well. Is there someone more famous that we can put in here?’ Of course, the creators always bristle at that and just want to do the right thing creatively. That was a big thing.”

He continues: “But Ed Helms had this giant advantage because of course he was in The Hangover. Not to completely read the minds of the network, but that was my understanding of how that decision got made.”

“I think the Hangover calculus sort of shifted things toward Andy pretty quickly,” adds writer Owen Ellickson.

Bradley Cooper
From left: Zach Galifianakis, Bradley Cooper and Ed Helms in The Hangover (2009)
| Credit: Shutterstock

Helms, 46, played Stu in 2009’s The Hangover, which became a box office hit and spawned two sequels, one in 2011 and another in 2013. The Office‘s first season without Carrell, 57, premiered in fall 2011.

“I do think that Andy was an interesting choice too, and believe me, I switched camps a lot,” says writer Amelie Gillette in the book. “I think a lot of us did because you don’t really know until you do it. But we felt like we could still get some juice out of Dwight not being number one, but being a foiled number one.”

Gillette adds: “We thought that might be a good comedic engine. I think that’s ultimately why Andy won out.”

Never miss a story — sign up for PEOPLE’s free daily newsletter to stay up-to-date on the best of what PEOPLE has to offer, from juicy celebrity news to compelling human interest stories

THE OFFICE -- "Local Ad" Episode 5 -- Aired 10/25/2007 -- Pictured: (l-r) Rainn Wilson as Dwight Schrute and Ed Helms as Andy Bernard
Rainn Wilson and Ed Helms in The Office
| Credit: Byron Cohen/NBCU Photo Bank

Writer Halsted Sullivan says the final choice to go with Helms over Wilson was a “photo finish,” and that there were “strong arguments for both.”

“Dwight was probably the expected choice and Dwight would have been an excellent manager. Andy was more the unexpected choice,” Sullivan says. “… It was not a black-and-white thing. We tried out Dwight in that role and in the end, we went with Andy. It was a photo finish.

The writer adds: “I think everyone would have been happy with either person in that role.”

The Office: The Untold Story of the Greatest Sitcom of the 2000s by Andy Greene is out March 24.