While How I Met Your Mother wrapped up a few years before New Girl came to a close, the shows both aired during the same time period. Sitcoms all have their own unique style, but they also share similarities with each other and build off of the comedies that came before them.

RELATED: How I Met Your Mother: 10 Most Heartwarming Scenes

Several characters from both series are alike when it comes to their views and interests, making them a great potential match if the loft mates ever ended up at MacLaren's Pub. Their similar personalities would help them bond, but for some of the more mismatched characters, coupling them off would be a disastrous mistake.

Would Work: Marshall & Jess

Marshall in How I Met Your Mother and Jess in New Girl.

Marshall and Jess are the kindest and most compassionate members of their friend group. They both like to come up with innovative ideas to bring everyone closer together, such as Marshall's board games and Jess's feelings stick.

They're optimistic even when they shouldn't be, but given how cynical their friends are, their positivity is much-needed. Marshall and Jess would be a perfect match for each other, and as we know from his relationship with Lily, Marshall loves teachers.

Wouldn't Work: Robin & Nick

Robin in How I Met Your Mother and Nick in New Girl.

Robin and Nick would be one of the most disastrous crossover pairings. Robin's dedication to her career would contrast with Nick's lack of motivation. Robin puts her all into everything she does, and Nick prefers to sit on the couch and eat takeout until his shift at the bar.

Nick doesn't have high self-esteem and even admits to not liking himself, and Robin is attracted to confidence. If Robin met Nick during New Girl season 7, they might have a chance, but the Nick from the first few seasons wouldn't be on Robin's radar.

Would Work: Lily & Cece

Lily in How I Met Your Mother and Cece in New Girl.

Cece is similar to Robin in a lot of ways, and Lily was shown to be attracted to her best friend on more than one occasion. Lily and Cece both have soft sides, but they also have no problem getting down and dirty if the situation calls for it.

RELATED: New Girl: 5 Times Jess Was A Great Friend (& 5 Times She Wasn't)

They're the type of characters who would click right off the bat, and end up being inseparable. Lily and Cece are down for anything, and their adventurous personalities would lead to all kinds of new experiences. No one will ever replace Robin for Lily, but Cece could come close.

Wouldn't Work: Barney & Jess

Barney in How I Met Your Mother and Jess in New Girl.

Barney and Jess would clash from the moment they met. Jess likely wouldn't buy into whatever lies he tried to tell her, but she wouldn't simply roll her eyes and go home. Jess always sees the good in people, and it'd be her mission to turn Barney into a better person.

Barney used his playbook to hide his true fears, and Jess would probably pick up on it just like Tracy did. A little bit of advice can go a long way, and although they'd never work romantically, a friendship is easy to imagine.

Would Work: Ted & Schmidt

Ted in How I Met Your Mother and Schmidt in New Girl.

It would never occur to viewers when watching the two shows, but after comparing and contrasting them, Ted and Schmidt are a lot alike. They're both prestigious and utterly ridiculous, but underneath it all, they're the greatest friends anyone could ask for.

Schmidt and Ted enjoy the same type of activities, and there would never be a problem choosing what to do or where to go. They'd genuinely enjoy each other's quirks, which is much better than being with someone who just puts up with them.

Wouldn't Work: Marshall & Cece

Marshall in How I Met Your Mother and Cece in New Girl.

The number one reason why Marshall and Cece would never work is their completely different views of the world. Cece is a hard shell to crack, and Marshall is the epitome of "soft and gooey." Sometimes these two personalities complement each other, but that's likely not what would happen in this situation.

RELATED: How I Met Your Mother: 8 Unnecessary Lies Ted & Marshall Told

Marshall wouldn't agree with how brutal and straightforward Cece is. She's all about tough love, while Marshall likes to sugarcoat things and soften the blow. They would clash far too often to have the kind of relationship that both of them deserve.

Would Work: Robin & Sam

Robin in How I Met Your Mother and Sam in New Girl.

Robin and Sam might not work long-term, but there's no doubt that they'd end up on a date or two if they ever ran into each other. Sam's good looks are talked about often in New Girl, and as a children's doctor, Jess thought he was the full package.

Sam is objectively a good person, and the only reason he and Jess didn't work out was that they were in love with other people. Robin isn't known for being very nice, but Ted was in love with her despite their opposite personalities, so it's definitely possible Sam could end up feeling the same way.

Wouldn't Work: Lily & Schmidt

Lily in How I Met Your Mother and Schmidt in New Girl.

Lily never even considered being with Barney and was consistently lecturing him on the lies he told to get women into bed. If Lily was disgusted by Barney, it's safe to assume she wouldn't be too interested in Schmidt either.

Schmidt isn't as bad as Barney is, but she would probably be so put off by him that she wouldn't stick around to meet the real him. Lily fell in love with Marshall because of his soft and kind-hearted ways, which isn't the vibe that Schmidt gives off.

Would Work: Barney & Cece

Barney in How I Met Your Mother and Cece in New Girl.

Cece wouldn't put up with the way Barney treats women and would help set him straight. A romance between them could parallel Barney's relationship with Robin, but hopefully, be more successful.

Cece has a goofy side that started to come out in later seasons, and she's down for just about anything. She and Barney would have a great time playing laser tag and coming up with pranks together. Personality-wise, they're surprisingly similar people.

NEXT: New Girl: 5 Times Nick Was A Great Friend (& 5 Times He Wasn't)