You've read it correctly on the first point. The use requirement is cumulative. It's 24 months of use as your main home inside the five years ending on the sale date, and those months don't have to be consecutive. Someone who lives in the house 14 months, spends 8 months elsewhere, comes back for 10 months and then sells has 24 months of use.
The two tests @thicket separated are worth keeping apart in your head. Ownership and use are about whether the home qualifies. The once-in-two-years limit is about you, the taxpayer, and it caps how often the exclusion can be claimed on a sale. That second one is what stops someone selling a live-in flip every twelve months and excluding all of it.
The amounts are up to $250,000 of gain for a single filer and $500,000 married filing jointly, and the married figure has its own conditions about how both spouses meet the tests. Since specifics change and the details of your own situation drive the answer, confirm all of it with a tax professional before you set a closing date.
One thing worth having straight before you plan around gaps in occupancy: time you own the home while someone else is renting it can create depreciation, and depreciation taken on the property doesn't get excluded the way the rest of the gain does. So moving out for a year and putting a tenant in isn't free even if your 24 months still add up.