How to Change True/False to Yes/No in Power Query
Question details
The user wants to replace boolean "True" and "False" values with the text strings "Yes" and "No" within a Power Query data column.
- Product
- Microsoft Excel (Power Query)
- Device & OS
- not provided
- Scenario
- Transforming boolean data columns into readable text formats during data preparation in Power Query.
- Observed behavior
- The user needs to convert the data type and format to display "Yes" or "No", but might encounter syntax errors if quotation marks are omitted.
Ensure your Power Query editor is open and you have identified the specific column containing the True and False values you wish to transform.
Edit the Conditional Expression to Return Text Strings
Modify your existing custom column or conditional expression to output text strings by wrapping Yes and No in quotation marks.
In Power Query's M language, true and false are recognized as boolean operators without quotes. However, custom text like Yes and No are string values. If you do not enclose text values in quotation marks, Power Query will look for variables named Yes and No, resulting in an error.
Load your data table into Power Query by going to the Data tab in Excel and selecting "From Table/Range".
Look at the "Applied Steps" pane on the right side of the window and double-click the step where you added the conditional or custom column.
In the formula box, update your expression to return text. Change the outputs so it uses Then "Yes" Else "No" instead of Then true Else false. Ensure the quotation marks are strictly placed around the words.
Click "OK" to apply the new expression. Finally, click "Close & Load" in the Home tab to return the updated, properly formatted data to your Excel worksheet.
Use WPS Spreadsheet for Easy Data Transformation
If you do not need complex Power Query setups, WPS Spreadsheet provides a lightweight and free alternative. You can easily convert True/False values to Yes/No directly using standard IF formulas.
- 1. Open your data in WPS Spreadsheet: Launch WPS Office and open your workbook containing the True/False data.
- 2. Insert a new formula column: Click the column letter next to your data, right-click, and select "Insert" to create a new column.
- 3. Apply the IF function: Enter the formula =IF(A2=TRUE, "Yes", "No") into the first cell and drag the fill handle down to convert all values.

Frequently Asked Questions
Why do I get an error when typing Yes and No in a Power Query conditional formula?
This usually happens because you forgot to wrap the text values in quotation marks (e.g., "Yes" and "No"). Without quotes, Power Query treats them as undefined variables or column names, resulting in a syntax error.
Can I use the 'Replace Values' feature instead of writing a formula?
Yes, you can use 'Replace Values'. First, change the column data type from True/False to Text. Then, right-click the column header, select 'Replace Values', find 'true', and replace it with 'Yes'. Repeat this step for 'false' to 'No'.
Does changing True/False to Yes/No affect the column's data type?
Yes. True and False are Boolean (logical) values, while Yes and No are Text (string) values. If you replace them, you must ensure the column's data type is explicitly set to 'Text' to avoid mismatch errors when loading the data back.




