[英]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. 我不确定您其余的情况如何,但这应该可以帮助您入门。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.