在一个单元格范围内找到一个值作为子字符串

编程入门 行业动态 更新时间:2024-10-25 23:30:35
本文介绍了在一个单元格范围内找到一个值作为子字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在选项卡1上,我有一列,其中该列中的每个单元格都有一组数字,而另一列中该组数字与一个名称相关联. 示例:

On tab 1, I have a column where each cell in that column has a group of numbers, and another column where that group of numbers is associated with a name. Example:

A1: 131,210,312,419,5010 B1: Jim A2: 210,311,517,614,701 B2: Tom A3: 51,120,210 B3: Sam A4: 311,701,1012 B4: Tim

在选项卡2上,我有一列数字. 示例:

On tab 2, I have a column of numbers. Example:

A1: 131 A2: 210 A3: 120 A4: 42

在每个数字旁边,我想返回与包含该数字的第一个列表关联的名称.所以在这个例子中,应该是...

Next to each number, I want to return the name associated with the first list which contains the number. So in this example, it should be...

A1: 131 B1: Jim A2: 210 B2: Jim A3: 120 B3: Sam A4: 42 B4: N/A

我在想可能涉及到find或vlookup,但我一直无法弄清楚如何将其组合在一起.

I'm thinking find or vlookup might be involved, but I haven't been able to figure out how to make it come together.

推荐答案

为了实现真正的匹配,您必须强制执行以下条件:所寻找的每个值都将以逗号开头和结尾.此字符串串联起来加上通配符将需要一个 array公式.

In order to achieve a true match, you must enforce the condition that each value looked for will begin and end with a comma. This string concatenation together with the wildcards will necessitate an array formula.

E1中的数组公式为=INDEX('Tab 1'!$B$1:$B$4,MATCH("*,"&D1&",*",","&'Tab 1'!$A$1:$A$4&",",0)).这需要 Ctrl + Shift + Enter 而不是简单的 Enter .输入正确后,可以根据需要填写.您可能希望应用IFERROR包装器来显示一个空字符串,而不是os #N/A.

The array formula in E1 is =INDEX('Tab 1'!$B$1:$B$4,MATCH("*,"&D1&",*",","&'Tab 1'!$A$1:$A$4&",",0)). This requires Ctrl+Shift+Enter rather than simply Enter. Once entered correctly, it can be filled down as necessary. You may wish to apply an IFERROR wrapper to show an empty string instead os #N/A.

更多推荐

在一个单元格范围内找到一个值作为子字符串

本文发布于:2023-11-09 23:07:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1573690.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:范围内   字符串   单元格

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!