简体   繁体   中英

Searching a cell with a string of comma delimited values in Excel

unfortunately i can't find the solution to the following problem.

I have a table (DATA) consisting of a column A with non-unique identifiers and a column B with several 4-digit codes separated by a space.

In another table (CODES) i have a column A for unique identifiers that are occuring in column A (DATA) and a column B with several, by comma delimited 4-digit codes.

应该是的例子

My goal is to check all entries in the first table (DATA) and list those NOK that have at least one code in column B identified in the other table (CODES)

I've used the following formula:

=IFERROR(IF(ISNUMBER(SEARCH(INDEX(CODES, MATCH([@A], CODES[A], 0), MATCH("B", CODES[#Kopfzeilen],0)),[@B])), "NOK", "OK"), "OK")

Unfortunately that only searches for the complete string in colum B (CODES) and not for every value delimited by a comma.

目前的例子

Is it possible to have a formula without using VBA (as this creates problems on sharepoint, where the file is being stored)?

Use FILTERXML:

=IF(OR(ISNUMBER(SEARCH(FILTERXML("<a><b>"&substitute(INDEX(CODES, MATCH([@A], CODES[A], 0), MATCH("B", CODES[#Headers],0)),",","</b><b>")&"</b></a>","//b"),[@B]))), "NOK", "OK")

Make sure you change #Headers to your language if different than English

This will need to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode in Excel 2013.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM