#62 - Search for A Specified String across The Whole Table

#62 - Search for A Specified String across The Whole Table

Problem description & analysis:

We have two Excel sheets, and there are same-structure tables in the two sheets.

Sheet1

ABC
1Col1Col2Col3
2foo1NA
3bar2y
4baz3bar
5foo4z
6bar5NA
7baz6foo

Sheet2

ABC
1Col1Col2Col3
2foo7bar
3bar8bar
4baz9bar
5foo10z
6bar11y
7baz12NA

Task: Search every cell of each table and match their values with a specified string, such as foo. If the matching succeeds, list the whole current row.

EFG
1
2foo1NA
3foo4z
4baz6foo
5foo7bar
6foo10z

Solution:

Enter the following formula in SPL XLL:

=spl("=(?1|?2).select(~.contain(?3))",Sheet1!A2:C7,Sheet2!A2:C7,"foo")

As shown in the picture below:

r/esProc_Desktop - Search for A Specified String across The Whole Table

Explanation:

The symbol | is used to concatenate two sequences.


The example was originally on StackOverflow. Feel free to compare the conventional solutions with the SPL approach to grasp the efficiency of esProc SPL. Download esProc Desktop and say hello to a streamlined table! 👋💻✨

SPL download address: esProc Desktop FREE Download

Plugin Installation Method: SPL XLL Installation and Configuration

References to other rich Excel operation cases: Desktop and Excel Data Processing Cases

YouTube FREE courses: SPL Programming