I think only three times in light aircraft as have managed to get back to home airfield with various problems on other occasions. Once was due to poor weather at Sedona (mega gusty winds, completely impossible to land, very rough!, not as forecast!) - turned back to airfield I had flown over a short while back (Plan B) to find it was now out of limits too. So went to Plan C and landed at Phoenix. Once as a "passenger" on a flight with a fuel problem - ie. I realised that we were getting low on fuel before the PIC did and weren't going to make planned airfield. Cue diversion, we just made it. And once, as a student pilot, on my solo long cross country, flew down a valley, viz closed in, couldn't get out of the valley to get over the mountains coz they had all disappeared in the poor viz! Did a 180 to discover it was even worse behind me, so landed at nearest airport (in the valley) and spent the night there! Had never been there before. Not bad for a student long cross country flight!!!