Most offices or other work situations contain a mix of personalities. You'll have coworkers you like, ones you tolerate, and a few who you find yourself hoping will be giving their two weeks' notice soon.

Sometimes, however -- whether you like the person or not -- a coworker can teach you a lot. That's not always intentional. Sometimes the lesson is in what not to do. But whether it's intentional or not, we can learn a lot from our coworkers if we're open to it.

The lessons below are from three Motley Fool writers who've been there. Not all are happy lessons, but each one shows the type of wisdom you may pick up from the people who sit next to you every day.

People work in an open office.

Sometimes the greatest lessons come from your coworkers. Image source: Getty Images.

Always be willing to help others

Maurie Backman: There's a reason I ultimately chose to become a writer and work as a contract employee from home -- I tend to strongly prefer working on my own to working with other people. But I didn't always have the luxury of such autonomy, and when I worked for a marketing firm, I was often forced into situations where I had to help others with a variety of tasks, from editing dashboard content on our internal system to helping the sales team create grammatically correct pitch sheets.

Though I always tried to be helpful, I'm sure there were numerous instances, especially early on, when I let slip a groan or a sigh. One day, however, I noticed my coworker, a user-experience designer, sitting patiently with a junior-level account manager as he explained how our new system worked. He must've been at that guy's desk for an hour, and I know I heard him repeat the same things over and over again -- things that were covered during account-manager training -- yet he never once showed any signs of annoyance or aggravation.

A few weeks later, during a team meeting, my coworker's patience was publicly acknowledged, and it helped me realize the importance of supporting one's colleagues, even if it meant losing valuable work time or pushing my tolerance to the limit. I can't say that from that day forward, I was always that person who assisted others with a smile, but I definitely got better about it, to the point where my helpfulness was mentioned as a positive trait on my performance review.

I've since moved on from that company, but my attitude shift helped me develop strong relationships with my coworkers, and that's something that continues to benefit me today.

Keep a sense of perspective

Selena Maranjian: A very long time ago, in the 1990s, I worked alongside someone with AIDS -- and at the time, there wasn't a lot of hope for anyone with such a diagnosis. I was young and didn't sufficiently appreciate it at the time, but she offered a great example of how someone can soldier on in the face of enormous difficulty. (Some such people do so because they want to, while others simply must.)

You're probably working alongside some people who are going through some tough times. It's helpful, when we get impatient or annoyed with our coworkers, to remember that old maxim: "Be kind, for everyone you meet is fighting a hard battle." It can vex us when others don't appreciate what we are dealing with in our own lives, so it's good when we can give others some leeway and compassion, too.

In many cases, coworkers just need understanding and flexibility. If they're single parents, for example, they may need to leave a little early to fetch a child or to take one to a doctor's appointment. If we put our own problems in perspective and are understanding about others and their needs, we may often find that coworkers are understanding toward us, too.

Just do your job well

Daniel B. Kline: About five years ago I worked for a major technology company as part of a small team that slowly got much bigger. I was the only person on the East Coast, with everyone else working together (at least sometimes) in a West Coast office.

Partly because I was remote and partly because it's my personality, I did whatever I could to stand out. I took on extra projects, did work nobody asked me to do, and made every effort to impress. It worked to a point -- my boss really liked me -- but my pace was probably not sustainable, at least with any sort of reasonable work-life balance.

One of my coworkers, a casual friend, worked in a different way. He was dedicated, hardworking, and well-liked, but he contained his work to his scheduled shift. This coworker did everything he could to help the product, his coworkers, and his bosses, but at the end of when he was supposed to work, he stopped working. (He was, of course, willing to work extra hours, but only when needed or asked, not by his own choice.)

My approach created a lot of noise. And although it brought me positive attention from various bosses, it was a showy strategy that perhaps did not endear me to every coworker. My colleague, over time, built up an impeccable reputation simply by coming in each day and performing his job as well as anyone else on the team.

That coworker eventually got promoted, and he remains at that company in an important position. Since working with him I have not been able to fundamentally change my personality, but I do make an effort to be more like him. That means working hard, being a great coworker, and remembering to sometimes walk away from my desk. In the long term that's a healthier approach, and it's one that leads to sustainable success.