ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   IF function and wildcards (https://www.excelbanter.com/excel-worksheet-functions/157127-if-function-wildcards.html)

Chacky

IF function and wildcards
 
Is it possible to use wildcards in an IF function to test a text string in a
cell.

I have a cell that could contain 2 text string options
"300 Denier Polyester" or
"600 Denier Polyester"

Because the operators who input this text may write it in different ways
(300 Denier Polyester or Polyester 300 Denier)
I would like to write an IF function in another cell that tests the cell in
question for whether the string contains 300 or 600 and depending on the
result, perform a different calculation

Bernard Liengme

IF function and wildcards
 
Something for you to experiment with:
=IF(ISNUMBER(FIND("300",A1)),"X","Y")
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Chacky" wrote in message
...
Is it possible to use wildcards in an IF function to test a text string in
a
cell.

I have a cell that could contain 2 text string options
"300 Denier Polyester" or
"600 Denier Polyester"

Because the operators who input this text may write it in different ways
(300 Denier Polyester or Polyester 300 Denier)
I would like to write an IF function in another cell that tests the cell
in
question for whether the string contains 300 or 600 and depending on the
result, perform a different calculation




Toppers

IF function and wildcards
 
try:

=IF(ISNUMBER(SEARCH("300",A1)),"300
Found",IF(ISNUMBER(SEARCH("600",A1)),"600 Found","Neither found"))

"Chacky" wrote:

Is it possible to use wildcards in an IF function to test a text string in a
cell.

I have a cell that could contain 2 text string options
"300 Denier Polyester" or
"600 Denier Polyester"

Because the operators who input this text may write it in different ways
(300 Denier Polyester or Polyester 300 Denier)
I would like to write an IF function in another cell that tests the cell in
question for whether the string contains 300 or 600 and depending on the
result, perform a different calculation


Rick Rothstein \(MVP - VB\)

IF function and wildcards
 
You can use Find for case insensitive searches like this....

=IF(ISNUMBER(FIND(300,A2)),"Yes","No")

If you need case sensitivity, then you would use the SEARCH function
instead.

Rick


"Chacky" wrote in message
...
Is it possible to use wildcards in an IF function to test a text string in
a
cell.

I have a cell that could contain 2 text string options
"300 Denier Polyester" or
"600 Denier Polyester"

Because the operators who input this text may write it in different ways
(300 Denier Polyester or Polyester 300 Denier)
I would like to write an IF function in another cell that tests the cell
in
question for whether the string contains 300 or 600 and depending on the
result, perform a different calculation



Max

IF function and wildcards
 
Thought it was the other way round ? <g
FIND is case sensitive while SEARCH is not
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Rick Rothstein (MVP - VB)" wrote:
You can use Find for case insensitive searches like this....

=IF(ISNUMBER(FIND(300,A2)),"Yes","No")

If you need case sensitivity, then you would use the SEARCH function
instead.

Rick



Rick Rothstein \(MVP - VB\)

IF function and wildcards
 
LOL... I think my mind wandered there a little bit, huh? What I was talking
about when I **started** me response was the fact that values such as 300,
where there was no case to worry about, work fine with the FIND function...
and then I have no idea what happened to my response by the time I finished
it. And I can't even use "it was a long response" to explain it either (that
was one of my shorter responses). Thanks for catching that.

Rick


"Max" wrote in message
...
Thought it was the other way round ? <g
FIND is case sensitive while SEARCH is not
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Rick Rothstein (MVP - VB)" wrote:
You can use Find for case insensitive searches like this....

=IF(ISNUMBER(FIND(300,A2)),"Yes","No")

If you need case sensitivity, then you would use the SEARCH function
instead.

Rick




Rick Rothstein \(MVP - VB\)

IF function and wildcards
 
As Max has pointed out elsewhere, FIND is a case **sensitive** function
whereas SEARCH is not. What I was trying to say, before I screwed my
response up royally, is that you can use FIND for this case because you are
looking for a value (300) which does not have upper/lower case issues.

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
You can use Find for case insensitive searches like this....

=IF(ISNUMBER(FIND(300,A2)),"Yes","No")

If you need case sensitivity, then you would use the SEARCH function
instead.

Rick


"Chacky" wrote in message
...
Is it possible to use wildcards in an IF function to test a text string
in a
cell.

I have a cell that could contain 2 text string options
"300 Denier Polyester" or
"600 Denier Polyester"

Because the operators who input this text may write it in different ways
(300 Denier Polyester or Polyester 300 Denier)
I would like to write an IF function in another cell that tests the cell
in
question for whether the string contains 300 or 600 and depending on the
result, perform a different calculation





All times are GMT +1. The time now is 09:35 AM.

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