Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Searching for double quote in a string

I've got a string that contains a double quote ("). It's a thickness
measurement in inches. I would like to extract everything in that string to
the left of - and including - the double quote.

I'm using the Left("String", characters) function to do this.
Unfortunately, the position of the double quote in the string changes so I
cannot hard code the number of characters in the Left function. I'm trying
to use the InStr function to programmically determine the double quote's
position and thereby determine the number of characters to return in the Left
function.

How do you tell the InStr function to search for a double quote since the
search argument is surrounded by a pair of double quotes.

Thanks

Jeff

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Searching for double quote in a string

from the immediate window to demonstrate:

sStr = "abcd""""efgh"
? sStr
abcd""efgh
? instr(sStr,"""")
5
? Left(sStr,Instr(sStr,""""))
abcd"


--
Regards,
Tom Ogilvy

"Jeff Harbin" wrote in message
...
I've got a string that contains a double quote ("). It's a thickness
measurement in inches. I would like to extract everything in that string

to
the left of - and including - the double quote.

I'm using the Left("String", characters) function to do this.
Unfortunately, the position of the double quote in the string changes so I
cannot hard code the number of characters in the Left function. I'm

trying
to use the InStr function to programmically determine the double quote's
position and thereby determine the number of characters to return in the

Left
function.

How do you tell the InStr function to search for a double quote since the
search argument is surrounded by a pair of double quotes.

Thanks

Jeff



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Searching for double quote in a string

How do you tell the InStr function to search for a double quote since the
search argument is surrounded by a pair of double quotes.


str1 = "aa" & Chr(34) & "bb"
iPos = InStr(str1, """")

This sets iPos to 3, which is what you want.

HTH,
Merjet


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
How can the SUBSTITUTE function replace a double quote? Florence Excel Worksheet Functions 6 April 3rd 23 02:26 PM
concatenate a double-quote Jack Deuce Excel Worksheet Functions 2 June 28th 09 10:27 PM
How do I change text qualifier from double quote? viof Excel Discussion (Misc queries) 1 September 7th 07 12:40 PM
Double quote delimiter script Mr BT[_2_] Excel Worksheet Functions 0 June 10th 07 06:18 PM
how do I create comma and double quote delimited file mikeb Excel Discussion (Misc queries) 1 November 29th 04 10:01 PM


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