I’ve spent time over the past year talking with young people about their hopes for marriage. And the question that comes up more than any other is: “How do I know if the person is the right one for me?” Is there a way to tell if someone is likely to be a compatible long-term mate, or a difficult and contentious partner?

Sounds complicated, right? But in our interviews with hundreds of long-married couples about what works and what doesn’t for a long and satisfying relationship, one simple and straightforward answer emerged again and again. It turns out that our elders believe there’s something close to a “magic bullet” when it comes to deciding in a relationship: “Should I stay or should I go?” And it all comes down to similarity.

But first, let’s take a look at conventional wisdom. Popular opinion tells us that opposites attract. Look at Romeo and Juliet coming from two perpetually feuding families. Or Tony and Maria in “West Side Story,” one Polish-American, the other Puerto Rican, and as different as they are they can’t resist one another. We believe that such different types are magnetically drawn together.

But do they live happily ever after? Certainly not in those two examples, nor in many others. Even The Little Mermaid — the original Hans Christian Anderson fairy tale, not the treacly Disney movie — winds up rejected by the handsome prince and dies. In literature and legend, at least, it’s tough to bring two different worlds together.

I’ve asked over 500 people married 40, 50 and more years what is most important for a long and happy marriage. To my surprise, their advice was nearly unanimous: Opposites may attract, but they don’t usually make for great and lasting marriages. Based on their long experiences both in and out of romantic relationships, the fundamental lesson is this: You are much more likely to have a satisfying marriage for a lifetime when you and your mate are fundamentally similar. And if you’re very different, the elders warn although that marriage can work, is likely to be much more difficult.

I can hear some of you saying: But it would be boring if two mates were exactly alike in interests and personality! Although it may sound paradoxical, long-married elders agree that some differences can spice up a relationship. But not all aspects are equally important. There are many ways partners can be similar, but the elders say that one dimension is absolutely necessary: Similarity in core values.

Now I have talked to many people entering into relationships over the years and I have heard all kinds of reasons for falling in love. Things like physical attractiveness, having a good sense of humor, making good money, being a nice person and physical attractiveness (okay, I said it already, but I hear it a lot). Searching my memory, I failed to come up with a single example of someone saying: “Oh, I’ve just met the most wonderful person. The best thing is — we share the same core values!”

The elders’ advice, however, is that alignment of values are precisely what we should look for if we want a long, happy marriage.

Take Emma, who at 87 has been married for 58 years. As she puts it, “It’s quite an achievement.”

“I didn’t know it when I got married, but in retrospect I know it’s important to have the same basic values. In other words, if you’re a free spender, marry somebody who understands that. If you’re frugal, you need to marry somebody who understands that, because money is one of the stumbling blocks in marriages. Fortunately we had the same values on most things.Because of this, we really didn’t argue. And we didn’t agonize over things. We came to our decisions by just realizing that we had usually the same goals.”

 The key phrases here are “we really didn’t argue,” and “we didn’t agonize over things.”

Arguments emerge over apparently trivial issues, the elders tell us, because they really reflect underlying values. Whether the wife purchases an expensive camera or the husband a new golf club is not the core issue in what can become a monumental fight, but rather the deeper attitude toward what money means, how it should be spent and whether the financial interests of the couple are more important than indulging an individual whim. Similarity in core values serves as a form of inoculation against fighting and arguing.

Keith, 78, told me:

“In my first marriage… we had whole different backgrounds, different perspectives. We came to the point where we asked: ‘What’s the point of this?’ I understood this in my second marriage, and it’s been wonderful for 24 years. It’s based this time on compatibility and understanding one another’s values. We’ve never had a fight. In other words, there’s no meanness, there’s no power struggles, no ‘my way is the right way,’ those kinds of things.”

Of course, to ensure shared values, there is a catch: Namely, you need to explore one another’s values while you are in the process of committing to a relationship. Ask the question: Do we believe the same things in life are important? The long-married elders recommend that you discuss this issue and to make sure core values are as similar as possible. A number of the elders offered this tip: Early in the relationship, each of you writes down your basic values or principles in areas like money, children, work, and sex — then share these statements with one another. Because value differences are likely to be at the heart many relationship problems, it’s much better to know them in advance of committing.

As a result of this kind of “values check,” people like April, 74, and her husband went into marriage knowing they were aligned on important issues:

We both had strong commitments in feeling that we owed something back…to the community, not only of resources but of time. We both loved to travel, and we had a sense of adventure. We liked the same people and I think that’s important. Very seldom did we disagree about friends. And parenting, of course. We had very similar values in terms of our kids and what we wanted for them.

The wisdom of the elders is very consistent with research findings over the past several decades. Social scientists who study marriage look for two things over the long term: marital stability (how long the marriage lasts) and marital quality (the sense of satisfaction and well-being partners experience).

The research findings are quite clear: marriages that are homogamous in terms of economic background, religion and closeness in age are the most stable and tend to be happier. Sharing core values has also been found to promote marital stability and happiness. So the elders are in the scientific mainstream when they urge you to seek a partner who is similar to you in important ways. But what should we do with this information?

In this advice, we come up against a dilemma. On the one hand, the elders agree that someone who is generally similar in upbringing, general orientation and especially values is the single most important thing in choosing a mate. On the other hand, we live in a pluralistic society that increasingly values diversity, breaking down old barriers and understanding and appreciation of differences. Is there a conflict here?

The message to take away from this lesson allows for both perspectives. People happily married for decades (and social scientists) don’t tell you unconditionally to avoid marrying someone who is different from you, but with whom you are deeply in love. They just want you to recognize that if you marry someone with values very different from yours, you are much more likely to face complex challenges in married life. According to the elders, in the face of objective differences (such as culture or economic background), shared values and outlook on life go a long way to promote both the quality and stability of a marriage.

(Interested in sharing your advice for marriage? Contribute your marriage lessons at the Marriage Advice Project.)