Problem with spaces in a Power Query ?

Keyboard

New Member
Joined
Jul 15, 2014
Messages
7
Hi,

I am struggling with Power Query in Excel.

I am trying to create a function to use in the spreadsheet.

My spreadsheet contains column headers with spaces in and therefore my query contains the same.

The problem seems to be that my query has spaces in there - if I change (Product name) to (Productname) then it works fine but I don't understand why this is and I would rather keep columns in the query named the same as the columns in the spreadsheet. Can I rewrite the below query so that it works by keeping the spaces in the column names?

let Category = (Product name) =><o:p></o:p>
<o:p></o:p>if (Product name) = "Car" then"Motorised"<o:p></o:p>
else if (Product name) = "Motorbike" then"Motorised"<o:p></o:p>
else if (Product name) = "Bicycle" then"Manual"<o:p></o:p>
else "Other"<o:p></o:p>
in Category<o:p></o:p>
 
Last edited:

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Just realised my mistake, I was entering it directly to the formula bar and the quotes were being doubled up and other weird stuff.

Works fine when I enter it using the Advanced Editor.
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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