Data Cleaning Reps

← All exercises

Average CO2 the right way

Intermediatesentinels + AVGVehicle fuel economy (FuelEconomy.gov, model years 2010–2027)

Return the average co2 (grams/mile) for model year 2011, ignoring the -1 placeholders, rounded to 1 decimal.

Hint

Filter out co2 = -1 (or turn it into NULL with NULLIF) before averaging.

Same question in Excel / Google Sheets

=AVERAGEIFS(O:O,B:B,2011,O:O,"<>-1")

Download the CSV from the datasets page. Column letters assume the CSV opens with its header in row 1.

Tip: Ctrl+Enter (⌘+Enter on Mac) checks your answer. Everything runs in your browser; nothing you type is sent anywhere.

← -1 means 'not available'Blank is not NULL →