#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Wild Cards

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Wild Cards

How about

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

HTH,
Barb Reinhardt



"KarenF" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Wild Cards

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" wrote:

How about

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

HTH,
Barb Reinhardt



"KarenF" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Wild Cards

You can use the IF Function...

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


--
Hope that helps.

Vergel Adriano


"KarenF" wrote:

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" wrote:

How about

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

HTH,
Barb Reinhardt



"KarenF" wrote:

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Wild Cards

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

KarenF

"Vergel Adriano" wrote:

You can use the IF Function...

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


--
Hope that helps.

Vergel Adriano


"KarenF" wrote:

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" wrote:

How about

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

HTH,
Barb Reinhardt



"KarenF" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wild Cards in Vlookup Hardeep Kanwar Excel Worksheet Functions 3 September 7th 09 06:40 AM
IF, INDIRECT, & Wild cards javablood Excel Worksheet Functions 8 July 13th 09 05:42 PM
wild cards? ferde Excel Discussion (Misc queries) 3 May 26th 07 06:28 AM
If Statement Using Wild Cards Jasmine Excel Worksheet Functions 5 August 23rd 05 10:38 AM
Wild Cards With Arrays Brian Excel Discussion (Misc queries) 4 July 7th 05 10:32 PM


All times are GMT +1. The time now is 05:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"