搜索数组元素

huangapple go评论81阅读模式
英文:

Searching through array of elements

问题

我在Excel公式中遇到了一个小问题。

在一个列中,我有随机字符串,另一个列用于标准化输入:

  1. 1
  2. 管理员
  3. 苹果
  4. 苹果汁
  5. 橙子
  6. 计算机设备
  7. 查找列:
  8. 管理
  9. 苹果
  10. 橙子
  11. 计算机

首选输出应该是:

  1. 输出
  2. 管理
  3. 苹果
  4. 苹果
  5. 橙子
  6. 计算机

所以,基本上我想使用xlookup函数来遍历查找数组中的所有元素,并返回文本的查找版本。我尝试使用"" &[查找数组] & ""。该函数会自动填充,所以对我来说不再是一个好的解决方案。

非常感谢任何帮助。

我还尝试使用搜索函数,但这个函数也会自动填充,我不确定是否需要额外的函数来将结果减少到一个单元格,或者是否需要完全不同的函数。

英文:

I've got a small issue with my Excel formula.

In one column I have random strings and the other one is used to standardize the inputs:

  1. Column1
  2. Administrator
  3. Apples
  4. Apple juice
  5. Orange
  6. Computer device
  7. Lookup column:
  8. Admin
  9. Apple
  10. Orange
  11. Computer

The preferred output would be:

  1. OUTPUT
  2. Admin
  3. Apple
  4. Apple
  5. Orange
  6. Computer

So, basically I want to use xlookup function to go through all elements from lookup array and return the lookup version of the text. I tried using "" &[lookup array] & "". The function spills so that is no more a good solution for me.

Any help would be greatly appreciated

I tried using search function as well but this one also spills and I'm not sure if I need extra function to reduce the result to one cell or maybe I need completely different function.

答案1

得分: 2

尝试这个。

=XLOOKUP(
TRUE;
ISNUMBER(SEARCH(TRIM(LookupColumn); String1));
LookupColumn;
"没有匹配项"
)
编辑:更改引用以更好地匹配问题中的示例数据

英文:

Try this one.

  1. =XLOOKUP(
  2. TRUE;
  3. ISNUMBER(SEARCH(TRIM(LookupColumn); String1));
  4. LookupColumn;
  5. "No matches"
  6. )

EDIT: Changed references to better match the OP example data

huangapple
  • 本文由 发表于 2023年7月13日 18:28:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/76678358.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定