No investor has a perfect track record, and I'm no exception. While my long-term investment returns have been ahead of the S&P 500, there have been several times along the way where I got it wrong.

I strongly believe in holding myself accountable, so without further delay, I'll share the three worst stock-investment decisions I ever made. And since I also believe that all great investors should learn from their mistakes, I'll discuss what I learned from these.

My 3 worst stock investments ever

In no particular order, here are the short versions of three investments I made that I consider to be my all-time worst.

Genetics-testing company 23andMe (ME 1.23%) went public a few years ago with backing from billionaire investor Richard Branson. It leads the market in home DNA testing and is starting to leverage its massive data library to produce pharmaceuticals. But the business was (and still is) hemorrhaging money and now trades for about 93% less than its valuation when it went public.

In the 2021 special-purpose acquisition company (SPAC) boom, a smart home technology company called Latch (LTCH -10.57%) went public. It was led by a former Apple (NASDAQ: AAPL) manager, and the business was gaining impressive traction in both the multifamily and office industries. However, due to several accounting mishaps and a lack of any reasonable path to profitability, Latch not only trades for a $125 million market cap but also ended up getting delisted from the Nasdaq for failing to file required financial statements.

Fortunately, the first two were rather small positions. The third, and perhaps my worst investment decision ever, was a stock that went up while I owned it. In mid-2011, I bought shares of a then-new electric vehicle (EV) start-up called Tesla (TSLA -4.95%). This was before the Model S started production, and when that vehicle was named Motor Trend's car of the year soon after its introduction, the stock roughly tripled in a short time frame. I sold my shares to "lock in my profits."

This paragraph is admittedly painful to write. I paid (split-adjusted) $1.53 per share for my Tesla stock. I sold it in 2013 at $4 per share. As I'm writing this, one share of Tesla is worth about $211. I could literally buy three fully loaded Model S vehicles with the money I left on the table by selling.

The valuable lessons I learned

Now, one important thing any investor should know is that even elite investors get it wrong from time to time. For example, Warren Buffett has made several billion-dollar stock investments, such as in IBM (NYSE: IBM), that didn't play out as he had hoped. I certainly don't consider myself to be anywhere close to Buffett's level, but of the 40ish stocks I own at any given time, I'm quite sure that a few will end up losing money, especially the small portion of my portfolio that I reserve for relatively speculative stocks.

As a stock investor, you'll have losing investments. That's a given. But the thing that distinguishes good long-term investors is being able to learn from the losses so you don't repeat the same mistakes. With that in mind, here are some of the lessons I learned from these three stock investments:

No matter how impressive growth is, valuation matters

I'm a value investor at heart, and the majority of my portfolio is made up of stocks that have below-average price-to-earnings (P/E) ratios. On the other hand, I completely understand that it's fine to accept a relatively high valuation if a company is growing rapidly and has tons of future potential. For example, I own shares of Shopify (NYSE: SHOP) and MercadoLibre (NASDAQ: MELI)d even though both look extremely expensive by most metrics.

However, there's a difference between a high valuation and an outrageous one. At the height of the SPAC boom, there were plenty of companies trading for multiples of 50 times sales (or even more) with no clear path to profitability in sight. Latch was one of these.

A great product doesn't always make a great business

This is an important lesson to learn and is a frequent topic of discussion during Shark Tank pitches. In my case, 23andMe was a great example of this. The company's consumer-genetics product is best-in-breed, and there is clearly potential in applying the genomic data from millions of customers to pharmaceuticals. But it's going to be very tough to turn it into a profitable business unless one of its treatments in development turns out to be a home run. Now, this is a $300 million market-cap company that has produced a combined operating loss of nearly $1 billion over the past four fiscal years and has burned through about $155 million in cash in the past year alone.

Never sell because of price alone

When I hit the sell button on Tesla, I only did so because it had gone up in value and I wanted to "take profits." If I looked at my two top holdings at the time a little more analytically, I would have most likely determined that the other one, AT&T (T -0.44%), was the one I should have sold.

This same lesson applies whether a stock moves up or down. Unless something has fundamentally changed with the business or your personal financial situation, price isn't a great reason to sell. For example, it would be fine to sell a growth stock like Tesla because you're retiring and your risk tolerance is now lower. But selling a winner to lock in profits is a losing long-term strategy.

Fortunately, I've learned from these mistakes. As an example, the best-performing stock in my portfolio has been a ten-bagger in less than a decade, and the reason I still own it has a lot to do with my Tesla mistake.

No investors are perfect, and I'm definitely not an exception. But smart investors admit when they're wrong and use what they've learned to become better.