Home » excel » excel – Find a value in a range of cells as a substring

excel – Find a value in a range of cells as a substring

Posted by: admin May 14, 2020 Leave a comment


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.

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

On tab 2, I have a column of numbers.

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

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

How to&Answers:

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.

       INDEX(MATCH()) with wildcards

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.


Entered as an array formula (Ctrl-Shift-Enter) and copied down, this works:


enter image description here