Wild Cards

K

KarenF

Hello all,

I'm trying to use a wild card to look up a value in column B to populate
column P. All I'm trying to do is a "contains" ABC.

The same statement without the wild card works.

Range("P2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-14]=""ABC"",True,False)"

But as soon as I introduce the wild card, everything comes up false.

Range("P2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-14]=""=*ABC*"",True,False)"

I stole the wild card argument from an auto-filter statement, because I
didn't know what else to do. (I'm not a programmer.)

I suspect it's the quotes I have wrong, but I've tried every possible
combination and still can't get it to work. A simple fix, I hope?

Karen F
 
B

Barb Reinhardt

How about

ActiveCell.FormulaR1C1 = "=ISNUMBER(SEARCH(""ABC"",RC[-14]))"

HTH,
Barb Reinhardt
 
K

KarenF

Close! The problem is instead of TRUE or FALSE, I actually want to return a
couple different values. (2.5 if true, 1.5 if false, to be exact.) Is there
a place to plug the desired results into your formula?

Karen F

Barb Reinhardt said:
How about

ActiveCell.FormulaR1C1 = "=ISNUMBER(SEARCH(""ABC"",RC[-14]))"

HTH,
Barb Reinhardt



KarenF said:
Hello all,

I'm trying to use a wild card to look up a value in column B to populate
column P. All I'm trying to do is a "contains" ABC.

The same statement without the wild card works.

Range("P2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-14]=""ABC"",True,False)"

But as soon as I introduce the wild card, everything comes up false.

Range("P2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-14]=""=*ABC*"",True,False)"

I stole the wild card argument from an auto-filter statement, because I
didn't know what else to do. (I'm not a programmer.)

I suspect it's the quotes I have wrong, but I've tried every possible
combination and still can't get it to work. A simple fix, I hope?

Karen F
 
V

Vergel Adriano

You can use the IF Function...

ActiveCell.FormulaR1C1 = "=IF(ISNUMBER(SEARCH(""ABC"",RC[-14])), 2.5, 1.5)"


--
Hope that helps.

Vergel Adriano


KarenF said:
Close! The problem is instead of TRUE or FALSE, I actually want to return a
couple different values. (2.5 if true, 1.5 if false, to be exact.) Is there
a place to plug the desired results into your formula?

Karen F

Barb Reinhardt said:
How about

ActiveCell.FormulaR1C1 = "=ISNUMBER(SEARCH(""ABC"",RC[-14]))"

HTH,
Barb Reinhardt



KarenF said:
Hello all,

I'm trying to use a wild card to look up a value in column B to populate
column P. All I'm trying to do is a "contains" ABC.

The same statement without the wild card works.

Range("P2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-14]=""ABC"",True,False)"

But as soon as I introduce the wild card, everything comes up false.

Range("P2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-14]=""=*ABC*"",True,False)"

I stole the wild card argument from an auto-filter statement, because I
didn't know what else to do. (I'm not a programmer.)

I suspect it's the quotes I have wrong, but I've tried every possible
combination and still can't get it to work. A simple fix, I hope?

Karen F
 
K

KarenF

It works! I don't understand why, but this is exactly what I need, thanks ...

KarenF

Vergel Adriano said:
You can use the IF Function...

ActiveCell.FormulaR1C1 = "=IF(ISNUMBER(SEARCH(""ABC"",RC[-14])), 2.5, 1.5)"


--
Hope that helps.

Vergel Adriano


KarenF said:
Close! The problem is instead of TRUE or FALSE, I actually want to return a
couple different values. (2.5 if true, 1.5 if false, to be exact.) Is there
a place to plug the desired results into your formula?

Karen F

Barb Reinhardt said:
How about

ActiveCell.FormulaR1C1 = "=ISNUMBER(SEARCH(""ABC"",RC[-14]))"

HTH,
Barb Reinhardt



:

Hello all,

I'm trying to use a wild card to look up a value in column B to populate
column P. All I'm trying to do is a "contains" ABC.

The same statement without the wild card works.

Range("P2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-14]=""ABC"",True,False)"

But as soon as I introduce the wild card, everything comes up false.

Range("P2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-14]=""=*ABC*"",True,False)"

I stole the wild card argument from an auto-filter statement, because I
didn't know what else to do. (I'm not a programmer.)

I suspect it's the quotes I have wrong, but I've tried every possible
combination and still can't get it to work. A simple fix, I hope?

Karen F
 

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

Similar Threads


Top