Exchange-traded funds (ETFs) have surged in popularity over the past few years -- fund inflows set a new record in 2021. And even with the S&P 500 down nearly 15% year to date, those inflows remain robust. According to FactSet Research, $332 billion flowed into ETFs in the first half of 2022. If investors keep up that pace, more money will be deployed into ETFs this year than was invested in them in any other year besides 2021.

So while many people are exiting their stock positions amid this market downturn, it appears that as a group, investors are still piling into ETFs. In volatile markets, there's an added appeal to investments that provide low-fee access to a diversified basket of stocks within a certain sector or that fit a specific investment style or strategy. And they are well-suited for those who are taking a long-term approach, which is why they make a lot of sense for those investing for retirement. But can you retire a millionaire by investing in ETFs alone?

Building a million-dollar portfolio

Today, there are some 2,600 ETFs available in the U.S., and they come in every stripe, so you could certainly build a portfolio out of ETFs alone that includes a mix of aggressive growth, deep value, income focused, large cap, small cap, and everything in between.

But to reach a seven-figure value, the key ingredient is time. Let's see how long hitting that goal might take for someone who built their portfolio out of three ETFs that represent different segments of the market.

One would be an aggressive growth ETF, the Vanguard Information Technology ETF (VGT -2.65%), which invests in about 425 technology stocks of various market caps. Another would be a plain-vanilla large-cap fund that tracks the S&P 500, the SPDR S&P 500 ETF (SPY -0.87%). The third would be on the other end of the spectrum, a small-cap value fund, the Invesco S&P SmallCap Value with Momentum ETF (XSVM 1.07%).

Can you get there?

Let's look at the 10-year track records of these funds to get a sense of what type of returns they have generated in the past -- which included a long bull market and two bear markets. Through July 28, the Vanguard Information Technology ETF had an average annualized return of 18.1%, the SPDR S&P 500 ETF had an annualized return of 11.3%, and the Invesco S&P SmallCap Value with Momentum ETF had an annualized return of 11.9%.

If you invested $10,000 in each of these funds 10 years ago and contributed another $150 to each one monthly, you would have about $240,000 right now.

Now, let's consider their returns over an even longer timeline. Two of these funds don't have track records that go back 20 years. But since its inception in 2004, the Vanguard ETF has recorded an 11.2% annualized return. And since it was launched in 2005, the Invesco fund has enjoyed an annualized return of 6.9%. The SPDR fund, which has been around the longest, had an annualized return of 7.8% over the past 20 years.

Now, based on the same scenario above with $10,000 initial investments plus $150 monthly contributions, you'd have about $477,000 in your portfolio after 20 years, given these longer-term rates of return. Your total contribution over 20 years would be just $46,000 per ETF.    

So, applying those rates of return out further into the future, a portfolio using this investment strategy and these three ETFs would need about 28 years to hit $1 million in value. So if you're just starting out as an investor and you're 40 or younger, it is certainly doable. If you are over 40, reaching that goal may require a more aggressive investing approach.

But of course, these are projections based on prior fund performance, and we can't assume the market will behave in the next 20 or 30 years the same way it has over the past 20 or 30 years. However, it should give you a general sense of the value of a long-term strategy.

Also keep in mind this hypothetical is but one example of a diversified ETF portfolio -- there are thousands of ETFs to choose from. Investors should focus on building a portfolio that fits their own unique risk tolerance and goals -- ever mindful of the fact that the longer the time horizon, the better off they will be in reaching that million-dollar goal.