* Comets have different orbits: Comets have highly elliptical orbits that take them far out into the solar system and then bring them back close to the sun.
* Not all comets are active at the same time: Some comets have very long orbital periods (hundreds or thousands of years), so they only come close to the sun once in a very long time. Others have shorter orbits and might come by more frequently.
To know when a specific comet last orbited the sun, you need to tell me which one you're interested in.
For example, if you're interested in:
* Comet Halley: It last orbited the sun in 1986 and is expected to return in 2061.
* Comet Neowise (C/2020 F3): It last orbited the sun in 2020 and won't be back for a very long time.
Let me know which comet you're curious about, and I can give you a more specific answer!