I am a little bit confused about the exact formula behind R2. the first one is this formula:

and we have also this formula
could you please explain me what are the difference? when I put my predicted, and actual values in excell sheets, the second formula give me the similar results to the R2 that I obtain from trendline in excel.
