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

esProc DesktopesProc Desktop
2 min read

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

0
Subscribe to my newsletter

Read articles from esProc Desktop directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

esProc Desktop
esProc Desktop

esProc Desktop is a desktop data processing & analytics tool and is specifically designed for ordinary business people. It supports complex computations & spreadsheet data manipulation, can deal with tasks that are hard to accomplish in Excel, and in addition, generates more concise code than VBA and Python. esProc Desktop boasts all-around programming capabilities, supports multi-step interactive data analytics and is easy to use without configurations. This significantly lowers the technical threshold for data analytics.