Somewhere along the way, most founders realize things aren't going according to plan. This shouldn't be a surprise--a startup is basically a double scoop of hopes and dreams, drizzled with uncertainty. You might update your road map hourly, but eventually you end up somewhere you never expected to be.

A year ago, the plans for Iodine--my startup--were carefully scripted. We began 2016 with two great products: a website and a mobile app. Both were growing in popularity with consumers, and we had begun trying to translate that appeal into actual revenue. This isn't a straightforward proposition, though, because in the health care industry, consumers don't generally pay directly for things like apps and websites. To make money, we needed to pull off a bank shot that would turn consumer traction into enterprise revenue. Fortunately, we were able to quickly line up commitments with big partners--health insurers and hospital systems--that allowed us to offer our products to their patients. The model is fairly simple: The more patients use our products, the more we get paid. All we had to do was convert those commitments into paying contracts.

That was the plan. But sales cycles are notoriously slow in health care. We knew this going in, but knowing it and living it are very different things. Letters of intent would be drafted and then disappear for months, lost in corporate legal departments. Software security reviews would be scheduled and then postponed for a month, and then two. The process was taking much longer than even our more pessimistic forecast.

As weeks turned into months, it became apparent that we weren't following a road map so much as trying to machete our way through an impene­trable thicket. That isn't progress--that's a slog.

Meanwhile, back in product land, things were still humming along. More and more people were finding our website--and finding it useful. Then Apple invited us into a (nonpaying) partnership. Three years of effort were finally bearing fruit.

But nobody was actually buying the fruit. And without paying customers, we couldn't raise outside capital. And without new capital, we couldn't add to our team to speed up our sales effort. In time, we'd be out of capital altogether. Running out of money is never in any startup's plan either.

At this point, my co-founder and I realized we needed to find a different sort of partner. Not one that would pay for our services, but one we could actually join forces with to make the business part of the equation easier. Perhaps the best way to grow was to merge with a company that could work with us to capitalize on the products--and the team--that we had successfully built. We realized we didn't need a Series A round. Or a B or C round. What we needed was M&A.

This wasn't an easy realization. It's meant detouring from our map--that carefully crafted document, with its well-articulated quarterly targets and nicely charted growth models--and plotting a new course. It's also a notoriously lonely place to be. Luckily, I have a few friends who have sailed their startups through similar waters.

Their advice coalesced into three points. First, talk to every possible partner. There's no telling who might be interested in a deal, so it's essential to cast the net far and wide. Second, run a process. Track every conversation, set deadlines for interested parties, and establish your terms clearly and definitively. And third, don't do it halfway. If you are exploring a deal, you need to commit to it. We needed to make it happen.

And so we began, and made a new plan.

The search got started with several weeks of hint-dropping emails and coy phone calls to appropriate prospects. We'd mention that we were "exploring partnerships" and looking to "join forces," with the hope that we'd find not just interest on the other end, but the right sort of interest--interest in the team we'd built, in the product we'd created, and in the progress we'd made--which would make a merger right for both parties.

As advised, we ran a process, exploring dozens of possibilities. But advice can vary. Some suggested we tell our team we were shopping a deal, while others insisted we spare them the angst until all the papers were signed. We decided on not telling them. Our concern was that they would (not without reason) start to fret. We needed them to be engaged in what they were doing. And we certainly didn't want them to start looking for work elsewhere. Keeping our people was going to be integral to a successful deal. Some suggested that we push hard on a number of financing options and exits, while others counseled a focus on one strategy alone. In the end, the best advice came from our ace lawyer, Michael Esquivel, who kept making the same point. "Com­panies don't get sold," he told us. "They get bought." We took heart in that; he meant we needed to believe in the company we had built. But he also meant we needed to find a partner that believed in it as much as we did.

Finally one clear favorite emerged: GoodRx, a Santa Monica, California-based company with a mission that's complementary to Iodine's. GoodRx's technology--its website and apps--helps people find the lowest price for a medication at their local pharmacy, a godsend for those with no insurance or with high-deductible insurance (the company gets advertising and referral fees in return). Not only was GoodRx involved in the same area of health care as Iodine--improving the consumer experience around pharmaceuticals with better data--but the founders are good souls too. We'd benefited from their savvy advice in recent years, and a merger made sense all around.

Still, even after everyone had agreed on the nitty-gritty, the deal had to get done. And so we entered a frenzied, two-month march of paperwork, lawyers, due diligence, and investor updates.

About those investors: We were decidedly lucky that they were supportive and patient. Every one of them signed on to the deal promptly. (Why? Keeping them posted with thorough updates every two months over the past three years paid off. I can't recommend that enough.)

We closed the deal two days before Thanksgiving. And then we told the team the news. Though the details came as a surprise, most had figured something was up. There were smiles all around, and enthusiasm for the new partnership. It was surely the biggest relief of my life.

Truly, honestly: We couldn't be happier. Our small team stayed together and held fast during the tumult, and they took the news with delight. As part of the GoodRx family, we've pretty much gone back to work on what we've been building all along. In fact, we've put the pedal down, offering richer, better consumer resources at Iodine.com.

The whole process took a good six or seven months. We're still part of a small and growing team, we're still focused on using data to help people, and I'll still be sharing the hard-won lessons of startup life with you in Inc.'s pages.

Last August, back when I still thought M&A would be a relatively quick and painless process (ha!), I had dinner with a friend who'd walked over the startup coals himself a couple of years prior and managed to sell his company. His words still echo in my mind. "You just have to do one thing," he said over a third bourbon. "Just land the plane. Land the plane. Don't let it crash into a mountain."

It wasn't easy, but we managed to do just that--and to refuel for another jaunt. This journey isn't over yet, not by a long shot.

How to work your way through M&A

Deciding to sell or merge is difficult. Going about it badly is far worse. Keep these points in mind:

  1. Talk to every possible partner. There's no telling who might be interested in a deal, so it's essential to cast the net far and wide.
  2. Run a process. Track every conversation, set deadlines for interested parties, and establish your terms clearly and definitively.
  3. Don't do it halfway. If you are exploring a deal, you need to commit to it.
FROM THE APRIL 2017 ISSUE OF INC. MAGAZINE