Power QueryExercises

Convert Yes/No answers to true, false or null (charity)

The marketing opt-in column mixes Yes, Y, no, N, blanks and nulls. Turn it into a proper true/false column.

Level
beginner
Time
~7 min
Task
Build the query
Access
Free — no account needed
Loading the practice workspace…

About this exercise

What you'll practise

Build a logical column from inconsistent text, keeping 'no answer' distinct from 'no'.

Riverside Food Bank (fictional) collects volunteer contacts on paper forms, typed up by different people.

Steps

  1. Add Marketing OK: true when OptIn is yes or y (any capitalisation), false when it is no or n, and null when OptIn is empty text or null.
  2. Output ContactID, Name, Marketing OK (drop the original OptIn column).

Your result must

  • Yes/Y/yes → true
  • No/N/no → false
  • Blank or null → null, not false

Input

  • Contacts (table)
    • ContactID: text
    • Name: text
    • OptIn: text (nullable)

Expected output columns

ContactID (text), Name (text), Marketing OK (logical (some rows null))

First 3 of 7 expected rows
ContactIDNameMarketing OK
C0001Mateo Castillotrue
C0002Farah Duartetrue
C0003Idris Yilmazfalse