There is no one-size-fits-all answer. It depends on the availability of homes that meet your criteria. If there are many properties on the market, you’ll probably find something within a month of actively looking. If you are looking for something specific, it can take months (sometimes years) for that property to come on the market.
A good way to establish a timeframe for looking at homes is to work backwards from your ideal move-in date. If you are renting, when does your lease expire? If you are selling first, when is your settlement date? Do you want a few weeks overlap so you can make improvements and take your time to move? Are you flexible?
Factor that it will take 1 month to go from contract to closing in a regular sale, 1.5 months if it is a foreclosure, and 4-6 months if it is a short sale.
Some of my clients have found their home in one weekend, but most clients see around 20-40 homes before they write an offer. So you might want to start looking 2-3 months out from your move date (unless you want a short-sale).
So let’s say Buyer X’s lease expires December 31. X wants 2 weeks between settlement and moving out of his rental in order to make some changes to the home. Subtract two weeks, and you get Dec. 17. If X buys a home in normal conditions (not a short-sale), X will want to be under contract by Nov. 17. Buyer X should probably start actively looking at homes sometime in September, if there are a number of homes that match his criteria.