PC Review


Reply
Thread Tools Rate Thread

How to search within a single cell

 
 
Etrnal168
Guest
Posts: n/a
 
      9th Dec 2005

Hey guys, first of all, thanks for reading.

I want to be able to search for a string in a cell. For example,

The content and location of the cell is 'Storage(PCI-X)' and
cells(1,1)

and I would like to search to see if the content contains PCI-X

can I do

with .range(cells(1,1))
set c = .find('PCI-X', LookIn:=xlValues, lookat:=xlWhole)

if c = true
blahblah
else
blah blah


Thanks!

-Tom


--
Etrnal168
------------------------------------------------------------------------
Etrnal168's Profile: http://www.excelforum.com/member.php...o&userid=25135
View this thread: http://www.excelforum.com/showthread...hreadid=492343

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      10th Dec 2005
Take a look at instr in VBA's help.

dim myStr as string
mystr = Worksheets("sheet1").Range("A1").Value
If InStr(1, mystr, "PCI-X", vbTextCompare) > 0 Then
'found it
Else
'nope
end if

Etrnal168 wrote:
>
> Hey guys, first of all, thanks for reading.
>
> I want to be able to search for a string in a cell. For example,
>
> The content and location of the cell is 'Storage(PCI-X)' and
> cells(1,1)
>
> and I would like to search to see if the content contains PCI-X
>
> can I do
>
> with .range(cells(1,1))
> set c = .find('PCI-X', LookIn:=xlValues, lookat:=xlWhole)
>
> if c = true
> blahblah
> else
> blah blah
>
> Thanks!
>
> -Tom
>
> --
> Etrnal168
> ------------------------------------------------------------------------
> Etrnal168's Profile: http://www.excelforum.com/member.php...o&userid=25135
> View this thread: http://www.excelforum.com/showthread...hreadid=492343


--

Dave Peterson
 
Reply With Quote
 
BenjieLop
Guest
Posts: n/a
 
      10th Dec 2005

Etrnal168 Wrote:
> Hey guys, first of all, thanks for reading.
>
> I want to be able to search for a string in a cell. For example,
>
> The content and location of the cell is 'Storage(PCI-X)' and
> cells(1,1)
>
> and I would like to search to see if the content contains PCI-X
>
> can I do
>
> with .range(cells(1,1))
> set c = .find('PCI-X', LookIn:=xlValues, lookat:=xlWhole)
>
> if c = true
> blahblah
> else
> blah blah
>
>
> Thanks!
>
> -Tom


The formula

=NOT(ISERROR(SEARCH(\"PCI-X\",A1)

will let you know if the string "PCI-X" is in Cell A1.

From here, you can use "if c = true, blahblah else blah blah" but you
have to convert it to the ff Excel syntax, i.e.,

=if(condition or argument,value if argument is true,value if argument
is false)

Hope this helps ...


--
BenjieLop


------------------------------------------------------------------------
BenjieLop's Profile: http://www.excelforum.com/member.php...o&userid=11019
View this thread: http://www.excelforum.com/showthread...hreadid=492343

 
Reply With Quote
 
Etrnal168
Guest
Posts: n/a
 
      10th Dec 2005

Thank you guys sooo much!

-Thoma

--
Etrnal16
-----------------------------------------------------------------------
Etrnal168's Profile: http://www.excelforum.com/member.php...fo&userid=2513
View this thread: http://www.excelforum.com/showthread.php?threadid=49234

 
Reply With Quote
 
BenjieLop
Guest
Posts: n/a
 
      10th Dec 2005

Etrnal168 Wrote:
> Thank you guys sooo much!
>
> -Thomas


Thank you for the feedback.

Regards.


--
BenjieLop


------------------------------------------------------------------------
BenjieLop's Profile: http://www.excelforum.com/member.php...o&userid=11019
View this thread: http://www.excelforum.com/showthread...hreadid=492343

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
consolidate data (i.e. a single cell) from multiple spreadsheets intoa single sheet James Sheriff Microsoft Excel Programming 4 4th Aug 2010 06:35 PM
Search within a single cell for a character AZSteve Microsoft Excel Programming 2 30th Apr 2010 02:46 AM
Using SEARCH in a single cell to COUNT multiple entries of same te tcbooks Microsoft Excel Programming 3 16th Jan 2009 09:54 PM
RE: Using SEARCH in a single cell to COUNT multiple entries of sam tcbooks Microsoft Excel Programming 0 15th Jan 2009 11:07 PM
RE: Using SEARCH in a single cell to COUNT multiple entries of same te JBeaucaire Microsoft Excel Programming 0 15th Jan 2009 09:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:41 PM.