Searching for records that end in a specific character

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi;

I have a two sheet workbook. One sheet allows for the entry of search
criteria in the upper half and the search results in the lower half. The
other sheet contains the records that are searched.

I have a situation where in one field called Location, there are similar
values such as Rack 1, Rack 11, Rack 12, etc. If I want to search for rows
that only have Rack 1 in the Location and I put in Rack 1 into my search
field, rows that have Rack 1, Rack 11, etc. come up as hits. Is there a
wilcard or other character that allows me search for a speciific value like
"Rack 1" ? By the way I tried putting Rack 1 in quotes and itr did not help.
Any assistance is greatly appreciated.
 
You could compare the length of the text in the searched fields against
your search criterion. "Rack 1" is six characters in length. "Rack
16" is seven characters. So if the length of your searched text
doesn't equal the length of the text you're searching for, the data is
not what you need.

Sorry, no time for specifics.
 
Hi,

What are you using to search through your code? VBA or Excel Functions?
Using VLookup there's a number you can include as a parameter that defines
whether to use wildcard or not I think. Look at the VLookup (or HLookup as
the case may be) in Excel Help for more info.

Hope this helps.
 
Kurt;

Thanks for the response. I'm using the following VBA code attached to a
search button:

Worksheets("Data").Range(DataRng).AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Worksheets("Results").Range(CritRng),
CopyToRange:=Worksheets("Results").Range(ResultsRng), _
Unique:=True

I'm entering text to search on in a cell.
 
Norman;

Thanks for the reponse. I tried your I idea and it got no hits. My search is
triggered by some VBA code attached to my search button as follows:

Worksheets("Data").Range(DataRng).AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Worksheets("Results").Range(CritRng),
CopyToRange:=Worksheets("Results").Range(ResultsRng), _
Unique:=True

I entered "=Rack 1" into my search criteria area and no hits came up after
hitting the search button. Any other ideas are appreciated.
 
Hi JJFJR,
I entered "=Rack 1" into my search criteria area and no hits came up after
hitting the search button. Any other ideas are appreciated.

My suggestion was:

="=Rack1"

Note the initial =
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top