Text.Middle not working Excel 2016

volius

New Member
Joined
Dec 5, 2017
Messages
2
Hi,

After Excel update from 2013 to 2016 version not working my oldest files with Power Query commands Text.Middle. i get the error "Text.Middle wasn't recognized"

if (Text.Length(
Code:
) = 25) then Text.Middle([Code],0,17) else Text.Middle([Code],0,10)

How fix this problem?
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
I don't see any problem with your IF. It works

Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Code", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Result", each if (Text.Length([PLAIN][Code][/PLAIN]) = 25) then Text.Middle([PLAIN][Code][/PLAIN],0,17) else Text.Middle([PLAIN][Code][/PLAIN],0,10)),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Code"})
in
    #"Removed Columns"[/SIZE]


CodeResult
abcdefghijklmnopr12345678abcdefghijklmnopr
abcdefghij12345abcdefghij
 
Last edited:
Upvote 0
Strange I dont have this issue. Are you sure the error does not come from somewhere else in the code? Also try to download the latest version of Power Query or Excel 2016 if you are on Office 365

anyway you can always use Text.Range as an alternative
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,552
Members
449,088
Latest member
davidcom

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