ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SEARCH function (https://www.excelbanter.com/excel-programming/428144-search-function.html)

lk[_4_]

SEARCH function
 
Hi

Hope this is the right place to post this - this is a formula question as
opposed to VBA but here goes.

I have a column which contains a mixture of numbers, text values and in some
cases a combination between the two for example
0
1
2
3
95*
DNB

I need an if statement to proceed determined by the contents. However if I
do

=SEARCH("*",A1) (or indeed any cell) I'm getting a 1. =SEARCH("d",A1)
gives me correct results either an error or the index of the character. It
seems something peculiar to the "*" character.

I can probably work around it but am I doing something wrong here - it's
Excel 2003 on XP SP3.

Thanks



Rick Rothstein

SEARCH function
 
The SEARCH function allows for wildcards and the asterisk is a wildcard
(meaning zero or more unspecified characters). The FIND function does not
allow for wildcards, so I would use that instead. Note, though, that FIND is
a case-sensitive search engine and SEARCH is case insensitive, so you need
to keep that in mind.

--
Rick (MVP - Excel)


"lk" wrote in message
...
Hi

Hope this is the right place to post this - this is a formula question as
opposed to VBA but here goes.

I have a column which contains a mixture of numbers, text values and in
some cases a combination between the two for example
0
1
2
3
95*
DNB

I need an if statement to proceed determined by the contents. However if
I do

=SEARCH("*",A1) (or indeed any cell) I'm getting a 1. =SEARCH("d",A1)
gives me correct results either an error or the index of the character.
It seems something peculiar to the "*" character.

I can probably work around it but am I doing something wrong here - it's
Excel 2003 on XP SP3.

Thanks



Rick Rothstein

SEARCH function
 
I just remembered, you can still use SEARCH if you want... the tilde (~)
character can be used to take away the wildcard meaning of a wildcard
character. So...

=SEARCH("~*",A1)

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
The SEARCH function allows for wildcards and the asterisk is a wildcard
(meaning zero or more unspecified characters). The FIND function does not
allow for wildcards, so I would use that instead. Note, though, that FIND
is a case-sensitive search engine and SEARCH is case insensitive, so you
need to keep that in mind.

--
Rick (MVP - Excel)


"lk" wrote in message
...
Hi

Hope this is the right place to post this - this is a formula question as
opposed to VBA but here goes.

I have a column which contains a mixture of numbers, text values and in
some cases a combination between the two for example
0
1
2
3
95*
DNB

I need an if statement to proceed determined by the contents. However
if I do

=SEARCH("*",A1) (or indeed any cell) I'm getting a 1. =SEARCH("d",A1)
gives me correct results either an error or the index of the character.
It seems something peculiar to the "*" character.

I can probably work around it but am I doing something wrong here - it's
Excel 2003 on XP SP3.

Thanks





All times are GMT +1. The time now is 12:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com