Idiom or saying for "nothing is bad without being good for something"

Solution 1:

I think what you're looking for is "every cloud has a silver lining":

every difficult or sad situation has a comforting or more hopeful aspect, even though this may not be immediately apparent

The meaning and origin of the expression: Every cloud has a silver lining - The Phrase Finder

Every cloud has a silver lining - Cambridge Dictionary

Solution 2:

Even a broken clock is right twice a day

This saying is usually applicable for people who are perceived to be incompetent and useless.

This means no one is ever completely wrong. As most of us have experienced, sometimes we receive the best advice from the most unexpected source.

Quora