Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default R1C1 Helper Instr / Mid

Hello:

How to make this formula based on "contains" rather than "equals"? My
attempts are not working:

With Range("[range]")
.FormulaR1C1 = "=(OR(RC[-1]={""Text1"",""Text2"", ""Text3"})"
End With

I have a string and I need to know which "contain" either of the three
texts. I've played around with mid and instr with no success.

Thanks, Germain
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default R1C1 Helper Instr / Mid

one way:

With Range("rng")
.FormulaR1C1 = _
"=SUM(COUNTIF(RC[-1],{""Text1"",""Text2"", ""Text3""}))0"
End With

or, if Text1 can appear anywhere in the cell:

With Range("rng")
.FormulaR1C1 = "=SUM(COUNTIF(RC[-1]," & _
"{""*Text1*"",""*Text2*"", ""*Text3*""}))0"
End With

In article ,
"Bettergains" wrote:

Hello:

How to make this formula based on "contains" rather than "equals"? My
attempts are not working:

With Range("[range]")
.FormulaR1C1 = "=(OR(RC[-1]={""Text1"",""Text2"", ""Text3"})"
End With

I have a string and I need to know which "contain" either of the three
texts. I've played around with mid and instr with no success.

Thanks, Germain

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default R1C1 Helper Instr / Mid

Thanks, Jack.
It works beautifully. The second was the solution I was after. The original
I posted works if the string is equivalent to a complete, discreet text (as
in "Text1"); the second you posted solves the "contains" query I was
attempting (string contains "Text1" or "Text2", etc.)

Your help always appreciated.

Germaine

"JE McGimpsey" wrote:

one way:

With Range("rng")
.FormulaR1C1 = _
"=SUM(COUNTIF(RC[-1],{""Text1"",""Text2"", ""Text3""}))0"
End With

or, if Text1 can appear anywhere in the cell:

With Range("rng")
.FormulaR1C1 = "=SUM(COUNTIF(RC[-1]," & _
"{""*Text1*"",""*Text2*"", ""*Text3*""}))0"
End With

In article ,
"Bettergains" wrote:

Hello:

How to make this formula based on "contains" rather than "equals"? My
attempts are not working:

With Range("[range]")
.FormulaR1C1 = "=(OR(RC[-1]={""Text1"",""Text2"", ""Text3"})"
End With

I have a string and I need to know which "contain" either of the three
texts. I've played around with mid and instr with no success.

Thanks, Germain


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
help on Converting R1C1 to A1 and A1 to R1C1..tia sa2 temp Excel Discussion (Misc queries) 3 September 13th 07 08:31 AM
help on Converting R1C1 to A1 and A1 to R1C1..tia sa2 temp Excel Worksheet Functions 3 September 13th 07 08:31 AM
Changing the Helper Column apples72 Excel Discussion (Misc queries) 12 November 13th 05 10:22 PM
InStr FGM Excel Programming 3 July 14th 05 08:47 PM
What is a helper column? RMPPOD Excel Discussion (Misc queries) 3 January 28th 05 07:37 PM


All times are GMT +1. The time now is 11:14 AM.

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

About Us

"It's about Microsoft Excel"