Scripture states what the flood destroyed: every living thing upon the face of the land. Scripture also states what the flood did not destroy: Noah's household and everything on the ark. Both of these important pieces of information are stated together in Genesis 7:23:
Thus He blotted out every living thing that was upon the face of the land, from man to animals to creeping things and to birds of the sky, and they were blotted out from the earth; and only Noah was left, together with those that were with him in the ark. (Genesis 7:23)Scripture excludes only Noah and those with him from the waters of judgment. Seven days before the flood, God told Noah why only he was excluded, "you alone I have seen to be righteous before Me in this time" (Genesis 7:1). The phrase in this time qualifies God's statement. Noah was certainly not the first man in the world who was seen to be righteous (see Enoch: A Prophet in the Pre-Flood World).
If God had simply stated, "you alone I have seen to be righteous before Me," the statement wouldn't have been totally correct. But because the phrase in this time is included, God's statement is accurate. Notice the ways in which God could have qualified His statement. He could have have stated that that Noah alone was seen to be righteous in this land. He could have stated that Noah alone was seen to be righteous in in his part of the world. But God did not make these statements. God qualified His statement with just one phrase: in this time.
Scripture, because it is God's own words, is consistent with itself. Genesis 7:1 describes what made Noah different than everyone else— what made him alone unique. Genesis 7:23 explains the outcome of Noah's uniqueness. Why would the rest of the world perish? Why would Noah and those with him be the only survivors? For no other reason than this: Noah alone was seen to be righteous!
The purpose of Genesis 7:23 is to emphasize the scope of the flood by describing both what the flood destroyed and what the flood did not destroy. Its purpose is to further magnify the destruction caused by the flood and to show the reader the wickedness of sin. How wicked is sin? Sin is so wicked that God judged man by sending a flood which covered the entire world. A flood that destroyed everything upon the face of the land— except for Noah and his household, who were shown grace by the God who saves His people.
Noah's Patience (Part 1) - Genesis 7:24
Evidence for a Global Flood: Every Living Thing Dies - Genesis 7:21-22
Evidence for a Global Flood: Water Above The Mountains (Part 1) - Genesis 7:19-20
The Time Comes to Enter the Ark - Genesis 7:1
Noah's Name: Its Meaning and Significance - Genesis 5:29