搜索数组元素

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

Searching through array of elements

问题

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

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

列1
管理员
苹果
苹果汁
橙子
计算机设备


查找列:
管理
苹果
橙子
计算机

首选输出应该是:

输出
管理
苹果
苹果
橙子
计算机

所以,基本上我想使用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:

Column1
Administrator 
Apples 
Apple juice
Orange
Computer device


Lookup column:
Admin
Apple
Orange 
Computer

The preferred output would be:

OUTPUT
Admin
Apple
Apple
Orange
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.

=XLOOKUP(
    TRUE;
    ISNUMBER(SEARCH(TRIM(LookupColumn); String1));
    LookupColumn;
    "No matches"
)

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:

确定