Will Ferrell

Just as Steve Carell is on his way out of Dunder Mifflin, Will Ferrell is moving in.

The 43-year-old funny man has signed on for a multi-episode arc on The Office, NBC announced Wednesday.

Ferrell will play a branch manager from the home office who rivals Michael Scott (Carell) in being inappropriate. Ferrell has signed on for at least four episodes, including one following Carell's exit.

Ricky Gervais to make a cameo on The Office

"We found Steve Carell when he was nothing but a movie star and we turned him into a television star," executive producer Paul Lieberstein said. "We are proud to continue The Office's tradition of discovering famous talent, and we hope that once America gets a good look at Will, they'll see what we see, tremendous raw sexuality."

Ferrell, who got his start on NBC's Saturday Night Live, is best known for his roles in the feature films Old School, Elf, Talladega Nights and Anchorman, the latter of which also starred Carell. He also guest-starred on NBC's 30 Rock and co-produces and recurs on HBO's Eastbound & Down.