Solomon's point in 7:16 seems to be this: do not pretend to be more righteous or more wise than you really are. No one is sinless--so don't act like it (cf. 7:20). Certainly there is no such thing as being too righteous (or too wise), for it is impossible to do (or to know) too much of that which is truly good and right. However, don't be self-righteous or wise in your own eyes--avoid that extreme. Likewise, avoid the extreme of being excessively foolish or wicked (7:17). This certainly doesn't suggest that wickedness or foolishness in moderation is acceptable. Solomon declared in 7:18 - "He who fears God will escape them all." Fearing God will provide the necessary balance in life.
As the inspired writer continued in 7:19, he elevated true wisdom (i.e., wisdom based on a deep reverence for God) as far better than the collective wisdom of experienced rulers. Solomon then noted that everyone, from time to time, says hateful things that they shouldn't. Thus, it is wise to "not take to heart everything people say." May we guard our own tongues carefully and be willing to forgive when others speak evil of us unjustly (7:21,22).
In 7:23-26, we can learn that wisdom cannot solve all the problems of life or answer every question. Solomon put a lot of effort and time into seeking the answers to his questions, but no one can fully grasp those things that are "exceedingly deep". We must, therefore, trust the purposes and plans of God when we encounter that which is beyond our understanding.
As Ecclesiastes 7 concludes, Solomon explained that the wise examine all of the evidence in an effort to understand or draw proper conclusions (7:27). However, even he in his great wisdom struggled with this. In his investigations, he found one wise (or righteous) man out of a thousand. Wisdom and righteousness have always been rare qualities. Although "God made man upright" (or righteous, 7:29), mortals have continually sought that which is evil. Man's pursuit of evil is clear evidence of his lack of wisdom.
We will continue this series of lessons next week.