Uses https://companiesmarketcap.com/ as the source.
The "Int" function rounds down to the number of whole trillion dollars
At the time of creating this question on 18 Aug 2025, the list at the source above was
1 NVIDIA NVDA $4.429 T
2 Microsoft MSFT $3.839 T
3 Apple AAPL $3.427 T
4 Alphabet (Google) GOOG$2.460 T
5 Amazon AMZN $2.458 T
6 Meta Platforms (Facebook) META $1.921 T
7 Saudi Aramco 2222.SR $1.555 T
8 Broadcom AVGO $1.417 T
9 TSMC TSM $1.249 T
10 Tesla TSLA $1.075 T
11 Berkshire Hathaway BRK-B $1.030 T
12 Walmart WMT $802.43 B
.
Walmart does not have a market cap of a trillion US$ so does not count. However higher ranked companies do have $1T or more market cap. In this case there are 11 and after rounding down these are added as 4+3+3+2+2+1+1+1+1+1+1 =20