Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default using a single quote ' in SEARCH function

I'm trying to see if the text in a cell contains the single quote (or
apostrophe). How can I put that in my SEARCH function. Surrounding the
single quotes with double quotes, like this SEARCH("'", A1) doesn't work. I
know there must be a forcing character to embed special characters in string
literals, but the documentation with 2007 Beta 2 is somewhat lacking, or I
just can't find it.
--
ExTexan
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,173
Default using a single quote ' in SEARCH function

ExTexan

Just wrapping the single in doubles or using a tilde ~ both work for me in
XL2007 RTM. The only time this won't work is if you have a single apostrophe
as the first character, as Excel uses this to signify text entry (You'll
also notice it doesn't show|) adding a second will return 1 from the SEARCH
function

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"ExTexan" wrote in message
...
I'm trying to see if the text in a cell contains the single quote (or
apostrophe). How can I put that in my SEARCH function. Surrounding the
single quotes with double quotes, like this SEARCH("'", A1) doesn't work.
I
know there must be a forcing character to embed special characters in
string
literals, but the documentation with 2007 Beta 2 is somewhat lacking, or I
just can't find it.
--
ExTexan


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default using a single quote ' in SEARCH function

If you ned to locate cells with leading apostrophes and don't mind a little
VBA, then enter and run:

Sub leading_tick_locator()
Dim r As Range, rSel As Range
For Each r In ActiveSheet.UsedRange
If r.PrefixCharacter = "'" Then
If rSel Is Nothing Then
Set rSel = r
Else
Set rSel = Union(rSel, r)
End If
End If
Next
If Not rSel Is Nothing Then
rSel.Select
End If
End Sub



It will select all cells with leading apostrophes and ignore embedded
apostrophes.

Have a pleasant weekend!
--
Gary's Student


"ExTexan" wrote:

I'm trying to see if the text in a cell contains the single quote (or
apostrophe). How can I put that in my SEARCH function. Surrounding the
single quotes with double quotes, like this SEARCH("'", A1) doesn't work. I
know there must be a forcing character to embed special characters in string
literals, but the documentation with 2007 Beta 2 is somewhat lacking, or I
just can't find it.
--
ExTexan

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
Need some comments on my Utility_Move class module. jchen Excel Worksheet Functions 0 August 21st 06 07:05 PM
numerical integration integreat Excel Discussion (Misc queries) 4 May 12th 06 02:40 AM
Custom functions calculating time arguments Help Desperate Bill_De Excel Worksheet Functions 12 April 25th 06 02:22 AM
Automatically up date time in a cell Mark Excel Discussion (Misc queries) 5 May 12th 05 12:26 AM
Search function using commas Kylie Excel Worksheet Functions 1 February 2nd 05 02:46 AM


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

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"