为什么这个过滤函数返回值错误?

发布于 2025-01-17 20:21:56 字数 497 浏览 1 评论 0原文

在下面的公式中,#Value!返回错误。

=FILTER(FIND(";"&AS4756:AS4762&{6,7},AG4756),ISNUMBER(FIND(";"&AS4756:AS4762&{6,7},AG4756)))

其中 ag4756 是 8034000;Y8033343543543;Y;38918;BS7 9XL;9;Male;N;N;N

, AS4756:AS4762 是

BS
NP
SN
GL
BA
CF
TA

当我选择评估公式时,它返回字符串 BS7 的数字 31 ,以及所有其他错误。我试图从结果中过滤掉错误,所以我只得到不是错误的结果。对于 BS7,它也正确返回 TRUE,对于所有其他,它返回 false。但下一步会导致错误。有人可以帮忙吗?

编辑:我想返回以 BS7 开头的子字符串的位置。或者BS6,或者NP6,或者NP7,等等。

In the formula below, a #Value! error is returned.

=FILTER(FIND(";"&AS4756:AS4762&{6,7},AG4756),ISNUMBER(FIND(";"&AS4756:AS4762&{6,7},AG4756)))

Where ag4756 is 8034000;Y8033343543543;Y;38918;BS7 9XL;9;Male;N;N;N

and AS4756:AS4762 is

BS
NP
SN
GL
BA
CF
TA

When I chose evaluate formula, it returns the number 31 for the string BS7, and errors for all others. I'm trying to filter out the errors from the result, so I only get the result which is not an error. It also correctly returns TRUE for BS7, and false for all the others. But then the next step results in the error. Can anyone help?

edit: I want to return the position of the substring that starts with BS7. Or BS6, or NP6, or NP7, and so on.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

面犯桃花 2025-01-24 20:21:56

好了,希望以下内容对您有所帮助;我们假设数据(垂直){BS;NP;SN;GL;BA;CF;TA} 位于 A1:A7 中,查找字符串位于 <代码>B1。然后,您连接第二个(水平)数组 {6,7} ,它将构成以下矩阵:

在此处输入图像描述

现在在 B1使用 FIND(";"&A1:A7&{6,7},C1) 将导致:

在此处输入图像描述

下一步是收集数字价值。但是,对于第二个参数,您提供了一个 7*2 矩阵,而不是一维垂直水平值数组。因此,FILTER() 将在步骤上出错,返回“#VALUE!”!即便如此,如果您尝试使用 MMULT() 技巧来正确检索此数组,您仍然需要处理您试图从填充的第一个参数中过滤矩阵的事实有错误。因此,我已经展示了如何从一个相对简单的公式中获取位置,该公式也可以处理错误:

=MAX(IFERROR(FIND(";"&A1:A7&{6,7},B1),""))

并且要获取正确的子字符串,请使用:

=MID(B1,MAX(IFERROR(FIND(";"&A1:A7&{6,7},B1)+1,"")),3)

现在这给我们留下了您想要更多潜在子字符串的可能性被退回。如果是这样,请在评论中告诉我。

Alright, I hope the following helps you out a bit; let's assume data (vertical) {BS;NP;SN;GL;BA;CF;TA} to be in A1:A7 and the lookup-string to be in B1. You are then concatenating a 2nd (horizontal) array {6,7} which would make up the following matrix:

enter image description here

Now to find these values in B1 using FIND(";"&A1:A7&{6,7},C1) would result in:

enter image description here

The next step for you would be to gather the numeric value. However, for the 2nd parameter, you have provided a 7*2 matrix and not a 1D-vertical or horizontal array of values. Therefor FILTER() will error out on exactly that step, returning the '#VALUE!'! And even so, if you would try to use MMULT() tricks to retrieve this array correctly you'd still need to deal with the fact you are trying to filter a matrix from the 1st parameter that is filled with errors. Therefor, I've shown how you could get the position from a relative easy formula that would deal with errors too:

=MAX(IFERROR(FIND(";"&A1:A7&{6,7},B1),""))

And to get the correct substring, use:

=MID(B1,MAX(IFERROR(FIND(";"&A1:A7&{6,7},B1)+1,"")),3)

Now that leaves us with the probability you have more potential substrings you'd like to be returned. If that is the case, let me know in the comments.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文