I thought of the same thing first Boromir, but...I thought it might not really be correct. One could say that, had Gandalf survived his duel with Durin's Bane, the Fellowship would have achieved its goal in the end but using another plan. Perhaps Gandalf knew some obscure pass in the mountains leading to Mordor, or perhaps he could make sure that the Orcs would not detect them so easily.
I agree that it was better that he died, many lives were saved through his rebirth, but still perhaps the quest would have been achieved even if he wouldn't have died.
Sauron expected the Ring to go to Minas Tirith so if the Fellowship managed to enter Mordor unseen they might have chances to make it to Mount Doom and destroy the Ring.