Consolidate data with conditions in Google Sheets