Syntax Error - Microsoft Query

Bryan1

New Member
Joined
Dec 8, 2016
Messages
9
I receive a Syntax Error when adding Criteria to a Microsoft Query in Excel 2013.

I've successfully used the criteria filter using the following information:

Field: Order
Operator: equals
Value: "4 digit number"

I am now attempting to change the field from Order to Transfer # which is when I receive the Syntax Error. I checked the format in the source workbook, and the format for both Order and Transfer # are the same. I even tried using other Field names from the source workbook, but I still receive the Syntax Error.

Any ideas on how to solve?
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Are you trying to define the criteria in the Query Wizard or in the SQL Query Editor?

In either case you should be able to select the field name and criteria value (if it exists in the dataset) from dropdown lists.
 
Upvote 0
I’m using the Query Wizard to select the source workbook and columns to extend to the new workbook. On the last step of the Query Wizard, I select the View data or edit query in Microsoft Query then Finish. In return, a new screen, Microsoft Query, appears. From this screen, I select Criteria at the top of the screen then add criteria.

Yes, the field I want to choose is in the drop-down box. Once I select it along with equal in the operator field and type it the value, that’s when the Syntax Error occurs.

I've tried selecting other field from the drop-down lists, and I do not receive the error.
 
Upvote 0
When you are in the MS Query editor, click on the "SQL" button. That will show you the SQL query statement that was build using the Wizard.
It should look something like this.
SELECT MyData.`Transfer #`, MyData.Name, MyData.`Order`, MyData.Sales
FROM `C:\test\Myfile_SQL data.xlsx`.MyData MyData
WHERE (MyData.`Transfer #`='4 digit number')

Copy and Post that code to this thread. Also, post the error message that you are getting when you try to run the query.

If the field name doesn't match your data exactly, then edit it in this SQL dialog and save the changes.
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,121
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top