You arrive in Spain on 18 March. You fly to the UK on 21 April and stay there until the 29th. On 30 April, you travel to Greece and stay until 23 June. Your trip was 97 days, but only 90 were in the Schengen Area.
You can’t re-enter the Area until at least 14 September, when the Spanish leg of your trip falls outside your 180 days.
If you re-enter on 14 September, you can only stay another 35 days as your time in Greece still counts towards your current 90 days.
If you re-enter on 22 September, you can stay another 90 days, as you haven’t been in the Area in the past 180 days.