Goldfish are the same family as Koi, although a Koi is a larger fish. A well cared for goldfish can live 10-20 years. In extreme cases 30. The oldest goldfish known and recorded was 44 years old. He was a prize at a fair in 1955 and was owned by the same person until it's death in 1999. That fish was in England and oddly enough, the now oldest living goldfish is also in England and is 43 years old. Maybe it's the water? By he way, that 44 year old fish was only 4 1/2 inches long at it's death. That is small, and was possible attributed to remaining in small bowls for most of it's life, or the growth stunted by a high nitrate level in the water. Some special varieties of goldfish are bred to remain small.
You are looking for an average age. A Celestial Goldfish or Bubble Eyed Goldfish as it is also called, has an average lifespan of 6-7 years.