"If it's any consolation" presents a small piece of good news in the context of a big piece of bad news.
"I'm sorry to tell you that your cat was killed by a car this morning. If it's any consolation, the car hit the cat at 85mph. So it died instantly and without pain."
It's often used humorously.
All the best,
- For Teachers