Expression.Error:无法识别名称"Text.BeforeDelimiter". Excel 2016 [英] Expression.Error: The name 'Text.BeforeDelimiter' wasn't recognized. Excel 2016

查看:1265
本文介绍了Expression.Error:无法识别名称"Text.BeforeDelimiter". Excel 2016的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Power Query编辑器中有一个excel添加列".我的数据看起来像这样,

I have an excel "Add Column" from Power Query editor. My data looks like this,

26567-5698
51254-5458
6954-1545
45415
56541
5621
..

有些在-之前有4位数字,有些在-之前有5位数字.对于介于两者之间的值为-的那些值,我喜欢提取第一部分(在定界符之前).

Some have 4 digits before - and some have 5 digits before -. For those values that have - in between, I like to extract the first part (before delimiter).

我尝试了以下方法,

if  
    Text.Length(Text.BeforeDelimiter([MyCol], "-")) = 4   
  then
    "0" & Text.Start([MyCol],4)
 else if  
     Text.Length(Text.BeforeDelimiter([MyCol], "-")) = 5   
  then 
     Text.Start([MyCol],5)
else
   [MyCol]

如果定界符之前的长度,我要添加0和前4位数字.否则,我想要前5位数字.

If the length before delimiter I am adding a 0 and first 4 digits. Otherwise, I want the first 5 digits.

执行上述操作时,出现以下错误:

When I do the above, I get the following error:

Expression.Error:无法识别名称'Text.BeforeDelimiter'. 确保拼写正确.

Expression.Error: The name 'Text.BeforeDelimiter' wasn't recognized. Make sure it's spelled correctly.

这是我正在关注的文档 .

Here is the documentation I am following.

我正在使用Excel2016.我一直在搜索,找不到任何与此相关的信息.任何帮助,将不胜感激.

I am using Excel 2016. I have been searching and could not find anything related to this. Any help would be appreciated.

推荐答案

您可以使用其他文本函数来解决此问题.

You can do a workaround with other text functions.

Left  = try Text.Start([MyCol], Text.PositionOf([MyCol], "-")) otherwise [MyCol]
Right = try Text.Range([MyCol], Text.Length([Left]) + 1) otherwise null

这篇关于Expression.Error:无法识别名称"Text.BeforeDelimiter". Excel 2016的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆