I used to get upset by this. Now, I use it as a lesson about how things don't always work out and there are often many failed experiments before getting it right.
Often times, great discoveries are made during the "failed" attempts. Microwaves, velcro, and x-rays are a few examples of this.
This not only applies to science, but also life. So many times, we do everything "right", but do not get the expected or wanted outcome. It can be frustrating and upsetting. We can feel like giving up.
The lessons we can learn from a science experiment is that we have to keep trying until we get it right, while also looking for other great discoveries in our failures. You never know what may come out of the rubble.
Have you ever discovered something great in one of your failures?