简体   繁体   English

当某些单元格包含多个值时如何搜索范围内的数据

[英]How to search for data in a range when some cells contain multiple values

I have a large data range that i am trying to match up with another data range. 我有一个较大的数据范围,正试图与另一个数据范围匹配。 Unfortunately i have multiple instances in which i have multiple data values in one cell. 不幸的是,我有多个实例,其中一个单元格中有多个数据值。 For instance a3 might be "10ab1" but a4 might be "10a, 10ab1, 9a". 例如,a3可能是“ 10ab1”,而a4可能是“ 10a,10ab1、9a”。 The data is always separated with a comma if there is more than one value. 如果有多个值,则数据始终用逗号分隔。 Sometimes there will be a number in with it eg "2504, 10ab1". 有时会有一个数字,例如“ 2504,10ab1”。 I have a list of values i am searching for. 我有一个要搜索的值列表。 (10ab would be one of them) If i find the value i want to conditionally color the cell. (10ab将是其中之一)如果我找到该值,则希望有条件地为单元格着色。 in this case A4 would be colored b/c 10ab is in it. 在这种情况下,b4中的A4将会是彩色的10ab。

How do i do this? 我该怎么做呢? Is there a way to do this WITHOUT using vba? 有没有办法不用vba来做到这一点? any help is greatly appreciated as my data spans 25 columns and is over 2000 rows deep. 由于我的数据跨越25列并且深度超过2000行,因此非常感谢您的帮助。 Thanks! 谢谢!

If your problem is only that you have multiple data in single cells, you my find useful the Microsoft article on Spliting text into different cells . 如果您的问题仅仅是单个单元格中有多个数据,那么我发现有关将文本拆分为不同单元格的Microsoft文章很有用。 Then the complexity of your problem will be reduced. 然后,您的问题的复杂性将降低。

The following formula should help you: 以下公式应该可以帮助您:

=TRIM(LEFT(SUBSTITUTE(MID(A1,FIND("|",SUBSTITUTE(A1, "a" ,"|",1)) -2 ,LEN(A1)),"",REPT( "b" ,LEN(A1))),LEN(A1))) = TRIM(LEFT(SUBSTITUTE(MID(A1,FIND(“ |”,SUBSTITUTE(A1, “ a” ,“ |”,1)))- 2 ,LEN(A1)),“”,REPT( “ b” , LEN(A1)),LEN(A1)))

The formula is going to extract the values of interest. 该公式将提取感兴趣的值。 You can utilize an IF statement to compare the values that are extracted with the formula with the values in your list for conditional formatting. 您可以使用IF语句将用公式提取的值与列表中的值进行条件格式的比较。

in this case, IF(Output from above formula = "10ab","True","False") 在这种情况下,IF(上述公式的输出=“ 10ab”,“ True”,“ False”)

The characters in bold are the parameters you will need to change for the conditional formatting. 粗体字符是您需要更改条件格式的参数。 the reason i highlighted -2 is because when it finds a it will move 2 characters to the left (- mean it moves to the left while + mean it moves to the right) 我突出显示-2的原因是,当它找到a时 ,它将向左移动2个字符(-表示它向左移动,而+表示它向右移动)

I'm not sure what the rest of your conditions look like but this should get you started. 我不确定您其余的情况如何,但这应该可以帮助您入门。

Source is from here . 资料来自这里

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当单元格包含多个值时,是否在单元格和列中搜索特定值? - Searching cells and columns for specific values when cells contain multiple values? Excel,在多个列中搜索包含部分相似数据的单元格 - Excel, search multiple columns for cells that contain partial similar data 修剪数据,其中一些单元格包含空间,某些单元格包含公式 - Trim data where some cells contain space, some contain formula 计数单元格是否包含范围内的数据 - Count cells if contain data from range 复制仅包含可见数据的单元格范围 - Copy range of cells that contain only visible data 将值添加到一系列单元格中,这些单元格的相邻单元格包含相同的值 - Add the values in a range of cells, whose adjacent cells contain same value 如果单元格包含多个逗号分隔值(来自另一个单元格),则求和 - Sum if cells contain a range of multiple comma separated values (From another cell) 如何在Excel中搜索特定字符串的单元格范围并返回不包含该字符串的单元格的值 - How to search for a range of cells in excel for a particular string and return the value of the cell that does not contain that string 如何确定一系列单元格是否包含连续数字? - How to determine if a range of cells contain consecutive numbers? 如何使用 excel 中的一系列单元格搜索网站以提取特定数据 - How to search a website using a range of cells in excel to extract specific data
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM