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

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
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,215,467
Messages
6,124,984
Members
449,201
Latest member
Lunzwe73

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