If you're looking for some stocks that can double your money fast, there are two ways to achieve it: Find an undervalued or high-growth company. On rare occasions, you can find a combination of the two with extreme upside potential.

Two I've identified that meet these criteria are Salesforce (CRM 1.27%) and Twilio (TWLO 1.84%). Let's look at why these two have the potential to double and what time frame investors can expect it in.

Each helps clients interact with their customers

Both companies provide essential software to client bases. Salesforce focuses on customer relationship management (CRM) software, which is used to market products, manage suppliers, and provide customer service. CRM is a must-have for any company with commerce sales, so switching away from the platform isn't easy, giving Salesforce some protection against economic downturns.

Twilio's customer-centric focus is similar to Salesforce, as its products help with customer communication. With APIs (application program interfaces) that help even novice coders create automated text messages, customized marketing emails, or programmable videos, it's a key component to ensuring customer satisfaction.

While these two aren't generally seen as direct competitors, they each have a similar goal and likely have some product crossover. Regardless, there is a massive market opportunity for engaging customers, so it's far from a winner-take-all competition.

Each stock also has a similar theme: undervaluation.

The stocks are undervalued from a historical perspective

Looking at each stock's historical price-to-sales (P/S) valuation, both companies are trading at discounts to their historical averages.

CRM PS Ratio Chart.

CRM PS Ratio data by YCharts.

Part of this valuation drop has to do with their revenue growth slowing down. For Salesforce, its fiscal year 2023 (ended January 31) annual revenue grew 18% year over year, but 2024 projections are only for 10% growth. So how does this constitute a rapidly growing company? It's not the revenue I'm talking about with Salesforce; it's the profits.

Salesforce is transitioning from a growth mentality to a mature business mindset. In FY 2024, Salesforce's generally accepted accounting principles (GAAP) operating margin is expected to be about 10.8%, substantially up from FY 2023's 3.3% margin. The stock could be headed for greater upside, with Salesforce about 25% below its historical P/S ratio and rapidly growing its profits.

Twilio is way below its historical P/S ratio at 2.8 times sales. One thing to note is that Twilio's gross margins aren't as great as most software companies -- they were 47% at the end of 2022. Its low gross margin can be attributed to paying carrier fees for text messages and other usage-based fees that its communications platform must pay on behalf of its clients. Because of that, Twilio can't post massive profits like most software companies do when fully mature, so it will always trade at a lower P/S ratio than its peers. But 2.8 times sales isn't reasonable.

For 2023, analysts expect Twilio to grow its revenue by about 12.4% -- an incredible slowdown from prior levels, but still faster than the market as a whole. As a result of this slowdown, Twilio has made moves to become more efficient, including two rounds of layoffs.

Investors will gain a better view of how Twilio is improving when it reports on May 9, but with its efficiency moves, it's hard to imagine Twilio's stock losing value because it's already at a historic low.

Expecting a stock to double is fine, but what matters is the timeframe it does it. If it takes 10 years to accomplish this task, you'd be better off investing in an index fund. With both companies rapidly increasing their profitability and still undervalued from a historical perspective, I'd say it's reasonable to expect a double in under six years -- if their growth pace stays the same. Should either's increase, then this timeline could be sped up.

Either way, I think both stocks have a great chance to beat the market moving forward, and investors should keep these two on their watchlist.