Lawrence "Rip" Smith (James Stewart) is a former basketball player and ex-military who now runs a company that perform polls and consumer surveys. Lately he has started obsessing about being able to find a perfect mathematical "miracle" formula to perform the perfect survey, and compete for real with his rival companies. Because he lacks funds, he is far behind his number one rival George Stringer.
One day Rip discovers that a survey made by a friend and ex-Army colleague of his, Hoopendecker (Kent Smith), in the small town of Grandview, exactly matches one that Stringer has made on a national level. Rip concludes that the small town demographic is a perfect match for the country as a whole, and believes he has finally found his miracle formula.
Eager to test his theory, Rip sells a survey on progressive education to a client, with a promise the result will stand for the whole country. Furthermore he promises to deliver the result the same day as Stringer's company, even though the rival has been working on the project for quite some time.
Rip and his team of professionals then travel to Grandview to perform the survey. They are pretending to be insurance salesmen. But trouble starts already when Rip overhears a conversation between a woman named Mary Peterman (Jane Wyman) trying to convince the mayor (Harry Holman) to expand the town and build a number of new buildings: a civic center. Rip wants this town to stay exactly as it is, so he can make his perfect surveys, mirroring the demographic of the country. Rip holds an electrifying speech to preserve the town, and the conservative members of the town council listens to him rather than Mary, whose proposition is laid to the side.
Mary writes a bold and angry editorial against Rip in the local newspaper, which is run by her family. Rip starts a charm offensive towards Mary to soften her up, but she holds her ground. The two combatants can't help being attracted to each other though. They spend a lot of time together while Rip secretly gathers information for his survey. One of Rip's colleagues warns him that he is becoming too involved in the subject he is supposed to be studying, but Rip is blinded by his own attraction to Mary. Rip starts coaching the school basketball team, and attends a school dance where he meets Mary's family. When Rip later slips away to talk to his client over the phone, Mary follows him, eavesdrops on the conversation, and finds out the truth about Rip being in town.
Angered by his deceit, she publishes the story in the newspaper the next day. A larger nationwide paper picks up the story, and soon the town is crawling with reporters. The town is called "the public opinion capital of the U.S." and its inhabitants start selling their views on consumer products on every street corner. The city council start making bold plans to expand the town, and both Rip and Mary feel ashamed of what they have done to change the town structure. Rip leaves Grandview and Mary and returns home. Soon enough a strange poll from Grandview says the Americans would want a female president. The town is ridiculed in the press and the expansion plans get an abrupt ending.
But Rip cannot seem to forget Mary, and he returns to Grandview to reveal his true feelings. Mary admits she has feelings for him too, but also tells Rip that they have to fix the mess they have caused in Grandview before they can start a relationship. Rip starts by talking to a Grandview U.S. Senator Wilton (George Irving), to get help from him raising money to save the town. They display their plan in front of the city council, but the lead council member, Richard Nickleby is negative. Upset, Rip tells Nickleby that he is "walking out on the team".
Later, Rip learns from Nickleby's son Hank (Mickey Kuhn) that his father already has sold land where the main expansion would take place to a company. To stop this, Rip manages to publish parts of the council speech a few weeks earlier, where it said that they would expand the town "with their own hands". A lot of inhabitants who read the article start demanding that the city council build on the designated land to save the reputation of the town.
It turns out the property sale agreement was not formally correct and the land is returned to the town. The inhabitants all pitch in to build a civic center on the land, and Rip and Mary become a couple.
As with Stewart's previous film, It's A Wonderful Life, the film was a notorious box office flop at the time of its release.
The film recorded a loss of $350,000.