Someone here on FR told me it was based on a movie called Good Neighbor Sam, which starred Jack Lemmon.
Oh, and my kids loved Dick York, and disliked Dick Sargent.
Bewitched was based on a movie called “I Married A Witch” with Frederic March and Veronica Lake, early 1940’s. Very funny movie.
The movie you're thinking of is Bell, Book, and Candle which co-starred Jack Lemon. The principles were Jimmy Stewart and Kim Novak.
Bell, Book, and Candle is the closer inspiration to Bewitched than I Married A Witch. The former is a present-day courtship movie while the latter is an across-the-centuries revenge rom-com.
-PJ