#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Test String

Hi,

I have 1000 comments in column A, one comment cell. In column B against each
comment I want to do a formula that returns a value (say 'R') if the word
'Rostering' appears in it.

Could someone please provide me with the correct 'IF' statement or any
alternatives?

Thanks
--
..
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Test String

One way:

=IF(ISNUMBER(SEARCH("rostering",A1)),"R","")

Copy down as needed.

Biff

"LucB" wrote in message
...
Hi,

I have 1000 comments in column A, one comment cell. In column B against
each
comment I want to do a formula that returns a value (say 'R') if the word
'Rostering' appears in it.

Could someone please provide me with the correct 'IF' statement or any
alternatives?

Thanks
--
.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Test String

On Tue, 28 Nov 2006 17:14:00 -0800, LucB
wrote:

Hi,

I have 1000 comments in column A, one comment cell. In column B against each
comment I want to do a formula that returns a value (say 'R') if the word
'Rostering' appears in it.

Could someone please provide me with the correct 'IF' statement or any
alternatives?

Thanks


I don't believe there are any functions that return the contents of cell
comments. So you'll need to write a VBA routine, and then test the returned
string.

So a formula of the type:

=IF(ISERR(FIND("Rostering",getcomment(A1))),"","R" )

Note that FIND is case-sensitive. If you want it to be case-insensitive, use
SEARCH.

=IF(ISERR(SEARCH("Rostering",getcomment(A1))),""," R")

The test text can be in a cell for easier editing, e.g:

=IF(ISERR(FIND(E1,getcomment(A1))),"","R")

To return the comment, you will need to write a short VBA routine.

<alt-F11 opens the VB Editor.

Ensure your project is highlighted in the Project Explorer window, then select

Insert/Module and paste the code below into the window that opens.

You can now use the GETCOMMENT function in your worksheet as in the above
formula.

'==========================================
Option Explicit

Function GetComment(rg As Range) As String
GetComment = rg.Comment.Text
End Function
'==================================



--ron
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
Message or input thesaxonuk Excel Discussion (Misc queries) 4 October 25th 06 09:38 AM
Hyperlinks in Excel Littlecleavesy Excel Worksheet Functions 1 October 19th 06 09:07 PM
Property Let: assign return value of Double when passing String Tetsuya Oguma Excel Discussion (Misc queries) 1 March 3rd 06 08:01 AM
Updating master workbook from source that may/may not exist [email protected] Excel Worksheet Functions 20 April 7th 05 03:37 PM
Copy a cell to all workbooks within a folder. Andy T Excel Discussion (Misc queries) 16 February 2nd 05 11:14 PM


All times are GMT +1. The time now is 08:25 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"