• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

LEN function equivalent in Power Query|Power Query|Excel Forum|My Online Training Hub

You are here: Home / LEN function equivalent in Power Query|Power Query|Excel Forum|My Online Training Hub

vba course banner

Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumPower QueryLEN function equivalent in Power Qu…
sp_PrintTopic sp_TopicIcon
LEN function equivalent in Power Query
Avatar
Cindy R

Active Member
Members
Level 0
Forum Posts: 5
Member Since:
April 17, 2019
sp_UserOfflineSmall Offline
1
April 20, 2019 - 2:16 am
sp_Permalink sp_Print

I am trying to remove the last 16 characters of a custom column in Power Query.  In Excel, I use the formula =right(A1,LEN(A1)-16).  I understand there is no LEN function in Power Query, so have tried using Text.Right([Product]),-16 and variations of that string to no avail, while I do not get a syntax error for the formula, once applied I get Text.Right not recognized.

 

Example of product info:

Vitamin C 24ct - 0011443388446

Herbal Formula 20ct - 9944881133005

 

I want to remove a total of 16 characters which includes all blank characters, the dash, and the upc numbers.  This seems like an easy issue but can not seems to get this to work. 

Any suggestions would be appreciated. 

Avatar
Cindy R

Active Member
Members
Level 0
Forum Posts: 5
Member Since:
April 17, 2019
sp_UserOfflineSmall Offline
2
April 20, 2019 - 7:42 am
sp_Permalink sp_Print

So I found a solution:  =Text.Start([Product],Text.Length([Product])-16)

This worked to remove lines that had items with UPC's, however some lines were category labels without UPC's (i.e. VITAMINS) so now I have "error" lines.  Will this cause the below error?? 

When I went to Close & Load - Only create connection, I am getting the following error:  [Expression.Error]The key didn't match any rows in the table. 

If the errors in my custom column are an issue, is there any if/then statement that would resolve my expression error?

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4524
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
3
April 20, 2019 - 9:43 am
sp_Permalink sp_Print

Hi Cindy,

Have you tried splitting the column by delimiter using the - as the delimiter? Then you can 'format' the column with Trim to remove the extra space on the end.

Mynda

Avatar
Cindy R

Active Member
Members
Level 0
Forum Posts: 5
Member Since:
April 17, 2019
sp_UserOfflineSmall Offline
4
April 20, 2019 - 12:36 pm
sp_Permalink sp_Print

Hi Mynda, 

Thank you for your response & excellent site!  I share your site with other Excel minded co-workers.

I ended up using an if-then-else statement and resolved my error lines.  However I am still getting Expression Error mentioned above, and download failed.  My data is linked to a folder on a cloud based share site, so co-workers are able to share files/work . . . not sure if this could be causing the issue download failure & Expression errors!? 

Thank you for any suggestions/direction.

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4524
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
5
April 22, 2019 - 10:02 am
sp_Permalink sp_Print

Thanks for your kind words, Cindy! Glad you figured out a solution.

In regards to your expression error, yes, Power Query cannot access an open file, so it may be having issues with the cloud based folder. You could try syncing the folder to your desktop and then referencing the files using From File > From Folder to the desktop location.

I've read other posts relating to this error and some have reported that refreshing the query inside the query editor fixes it, so it may be as simple as that. If you get an error refreshing the query then it might be a permission restriction.i.e. your PC doesn't have permission for that folder, or you need to enter login credentials for the query to work. If not, try moving the files to a synced folder.

Mynda

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1826
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
6
April 22, 2019 - 1:45 pm
sp_Permalink sp_Print

Hi Cindy,

When you import from a folder that might have some files open, it's a good idea to filter out the temporary files that are created by excel automatically when a file is open, those are triggering the error.

= Table.SelectRows(#"Filtered Rows", each [Attributes]?[Hidden]? <> true)

This way, PQ can access open files. Once those are filtered out, refreshing the PQ editor preview as Mynda mentioned will fix the error.

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Alicia Greynolds, Lee Mapes
Guest(s) 11
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 873
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 222
Jessica Stewart: 218
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Blair Gallagher
Brandi Taylor
Hafiz Ihsan Qadir
Gontran Bage
adolfo casanova
Annestine Johnpulle
Priscila Campbell
Jeff Mikles
Aaron Butler
Maurice Petterlin
Forum Stats:
Groups: 3
Forums: 24
Topics: 6369
Posts: 27852

 

Member Stats:
Guest Posters: 49
Members: 32359
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.