MIS Cheatsheets — Formula and SQL Quick Reference
Every pattern below is written against this track's practice dataset (sales.csv, reps.csv, targets.csv, returns.csv) and verified — see the Interview page for the fully worked, executed versions.
Excel lookups
|---|---|
| Exact-match lookup | `=XLOOKUP(lookup_value, lookup_array, return_array)` |
|---|
| Exact-match, older Excel | =INDEX(return_array, MATCH(lookup_value, lookup_array, 0)) |
| Two-way lookup (row + column) | =INDEX(data_range, MATCH(row_value, row_labels, 0), MATCH(col_value, col_labels, 0)) |
| Approximate-match band (e.g. commission tier) | =XLOOKUP(value, band_lower_bounds, band_labels, , -1) — the -1 means "next smaller item" when there's no exact match |
SUMIFS / COUNTIFS / AVERAGEIFS
|---|---|
| Sum with a date range | `=SUMIFS(amount_range, date_range, ">="&start_date, date_range, "<="&end_date)` |
|---|
| Count with a wildcard | =COUNTIFS(product_range, "Widget*") |
| Average with multiple conditions | =AVERAGEIFS(price_range, region_range, "East", status_range, "Completed") |
Logic and text
|---|---|
| Multiple conditions, no nested IF | `=IFS(cond1, result1, cond2, result2, TRUE, default)` |
|---|
| Safe division | =IFERROR(numerator/denominator, 0) |
| End of month | =EOMONTH(date, 0) |
| Working days between two dates | =NETWORKDAYS(start_date, end_date) |
Dynamic arrays
|---|---|
| Filter rows by condition | `=FILTER(range, condition_range="East")` |
|---|
| Unique values | =UNIQUE(range) |
| Sort by another column | =SORTBY(range, sort_by_range, -1) |
| Name an intermediate calculation | =LET(x, A2*B2, IF(x>100, "High", "Low")) |
SQL (SQLite syntax used by this track's tests — see the dialect note below)
|---|---|
| Clean a text-as-number column | `CAST(REPLACE(TRIM(col), '$', '') AS REAL)` |
|---|
| Fill a blank from another table | COALESCE(NULLIF(TRIM(a.col), ''), b.col) |
| Anti-join (reps with no sales) | SELECT rp.* FROM reps rp LEFT JOIN sales sl ON rp.rep_id = sl.rep_id WHERE sl.rep_id IS NULL |
| Running total | SUM(amount) OVER (ORDER BY order_date) |
| Rank within a group | RANK() OVER (PARTITION BY region ORDER BY revenue DESC) |
| Month-over-month growth | (amount - LAG(amount) OVER (ORDER BY month)) / LAG(amount) OVER (ORDER BY month) |
| De-duplicate, keep one row per key | ROW_NUMBER() OVER (PARTITION BY key_col ORDER BY key_col) = 1 (use your actual key column — order_id for this track's sales table) |
SQL dialect note: this track's tests run on SQLite. EOMONTH/NETWORKDAYS are Excel functions, not SQL — the SQL equivalent of "this month" date bucketing is usually strftime('%Y-%m', date_col) (SQLite), DATE_TRUNC('month', date_col) (Postgres), FORMAT(date_col, 'yyyy-MM') or DATEADD arithmetic (SQL Server), or DATE_FORMAT(date_col, '%Y-%m') (MySQL). LIMIT n (SQLite/MySQL/Postgres) is TOP n in SQL Server. Date-math functions differ the most across engines — see each interview task's answer for the specific SQL Server/MySQL equivalent where it matters.
DAX (Power BI)
|---|---|
| Measure (recalculates with filter context) | `Total Revenue = SUMX(Sales, Sales[qty] * Sales[unit_price])` |
|---|
| Calculated column (fixed per row at refresh time) | Sales[line_total] = Sales[qty] * Sales[unit_price] |
| Filter override | CALCULATE([Total Revenue], Sales[region] = "East") |