Trim in Power Query does not remove extra spaces between words

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
I noticed that Trim does not remove extra spaces between words.. only the leading and at the end spaces, If I have something like this

John Smith

then PowerQ will keep it as it is but if I hav something like tis

John Smith

Then I will get

John Smith

is that by design? Thank you very much.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Sorry, this form deleting the space between the first name and second name. Anyway, please see attached excel file. Trim() function deleting the spaces between the first and last name while PQ trim did not. Thank you very much.

Book1
ABCDEF
1NameLength_before trimName_trim(function)Length after trimName_after PQ trimlength after PowerQ Trim
2John Smith23John Smith10John Smith23
3 John Smith20John Smith10John Smith10
4John Smith 28John Smith10John Smith10
5 John Smith 29John Smith10John Smith23
6 John Smith 15John Smith10John Smith10
Sheet1
Cell Formulas
RangeFormula
B2:B6,D2:D6B2=LEN(A2)
C2:C6C2=TRIM(A2)
F2:F6F2=LEN(Table1_2[@[Name_after PQ trim]])
 
Upvote 0
Hi I thought you were talking about Excel Trim() function. I just reviewed Power Query Trim function and I now understand your point. Thank you.

 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,824
Members
449,050
Latest member
Bradel

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