Data Cleaning Reps

← All exercises

Bucket magnitudes into bands

IntermediateCASEEarthquakes (USGS, Oct 2026)

Label each event: below 4.0 is minor, 4.0–4.9 is light, 5.0–5.9 is moderate, 6.0+ is strong. Return each band and its count.

Hint

CASE WHEN checks conditions top to bottom and returns the first match.

Same question in Excel / Google Sheets

Helper column =IFS(F2<4,"minor",F2<5,"light",F2<6,"moderate",TRUE,"strong"), then pivot.

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.

← Events per dayThe deepest event →