Solved

# How to search a column for a string of text?

Posted on 2011-03-11
312 Views
How to search a column for a string of text?  I want to search for the value in b3, in column AA on sheet2.  The value of b3 could be anywhere withing the string of data housed in column AA

0
Question by:kgittinger

LVL 81

Expert Comment

In a formula or in VBA?

Kevin
0

LVL 81

Expert Comment

This array formula will return the row of the first occurrence of the sub-string:

=MIN(IF(ISERROR(SEARCH("*text*",A1:A100)),"",ROW(A1:A100)))

Enter by pressing CTRL+SHIFT+ENTER.

Kevin
0

LVL 24

Expert Comment

There are many options:
0

LVL 81

Expert Comment

Correction - you don't need wildcard characters when using the SEARCH function to find a simple substring:

=MIN(IF(ISERROR(SEARCH("text",A1:A100)),"",ROW(A1:A100)))

Kevin
0

LVL 39

Expert Comment

and =COUNTIF(AA:AA,"*" & B3 &"*") will give you the number of matches you got in the column

T

0

LVL 81

Expert Comment

Can you provide more information as to what you are trying to do?

Your question is somewhat vague and thus far has prompted three very different solutions. Experts will continue to post varying solutions that will ultimately generate more confusion than clarity.

Kevin
0

LVL 50

Accepted Solution

barry houdini earned 500 total points
If you want to find the position of the text in the column then MATCH with a wildcard would be a better option than using SEARCH, i.e.

=MATCH("*"&B3&"*",sheet2!AA:AA,0)

regards, barry
0

## Featured Post

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…