Insert Values in a Specific Column That Are Substrings of Values of Another Column to the Third Column

Problem description & analysis

Below is Excel file Book1.xlsx:

A

B

1

123

555

2

555

66

3

S666E

666

4

77E

123

5

444

6

Loop through each string in column A, during which if column B has one or more strings that are included in the current string, return the last-found one of the N eligible strings of column B to column C in the same row. Below is the desired result:

A

B

C

1

123

555

123

2

555

66

555

3

S666E

666

6

4

77E

123

5

444

6

Solution & explanation

Load add-in ExcelRaq.xll to Excel, and

Enter the following formula in cell C1: =esproc("=?1.select@z1(pos(?2,~))",$B$1:$B$5,A1) and drag C1 down to C5 to get all results.

Q & A Collection

https://stackoverflow.com/questions/63651616/looping-through-range-in-worksheet-and-updating-another-range