In the example, the formula in C5, which calculates percentage of year remaining, is:
How the formula works
the YEARFRAC function takes two dates, a start date and and an end date, and calculates the time between them in fractional years. In this case, we are using the end date as-is, but generating a start date that equals the first day of the same year with this bit of code:
This extracts the year value from the date in B5 and plugs it into the DATE function, along with a 1 for both month and day.
The result is that the YEARFRAC function returns a decimal value that corresponds to the fraction of the year between the two dates.
When this value is formatted with the percentage number format, it shows percent of year complete.
Percent of year remaining
To calculate percent of year remaining, just adjust the formula to subtract the fractional year from 1. In the example, D5 contains this formula: