ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   extracting part of string value (https://www.excelbanter.com/excel-programming/296051-extracting-part-string-value.html)

Dr. Schwartz[_3_]

extracting part of string value
 
I have a string value that varies in length. The first 13 characters I am not interested in, but the last part I'm interested in extracting. Here is a data example

SCR0334535 @ 0.01µ
SCR0334535 @ 0.03µ
SCR0334535 @ 0.1µ
SCR0334535 @ 0.3µ
SCR0334535 @ 1µ
SCR0334535 @ 3µ
SCR0334535 @ 10µ
SCR0334535 @ 30µ
SCR0334535 @ 100µ

How can I get the last part (character 14 and onwards) assigned to a new variable

Thank you

Sandy V[_6_]

extracting part of string value
 
Dr Schwartz,

Sub test()

s1 = "SCR0334535 @ 100µM"
s2 = Right(s1, Len(s1) - 13)

x = InStr(s1, " @ ") + 2
s3 = Right(s1, Len(s1) - x)

Debug.Print s2, s3

End Sub

If you don't know the length of the "first part", get as
described for "s3"

Regards,
Sandy

-----Original Message-----
I have a string value that varies in length. The first 13

characters I am not interested in, but the last part I'm
interested in extracting. Here is a data example:

SCR0334535 @ 0.01µM
SCR0334535 @ 0.03µM
SCR0334535 @ 0.1µM
SCR0334535 @ 0.3µM
SCR0334535 @ 1µM
SCR0334535 @ 3µM
SCR0334535 @ 10µM
SCR0334535 @ 30µM
SCR0334535 @ 100µM

How can I get the last part (character 14 and onwards)

assigned to a new variable?

Thank you
.


Dr. Schwartz[_3_]

extracting part of string value
 
Thanks Sandy, just what I needed

Jean-Yves[_2_]

extracting part of string value
 
Hi,
In one line
Sub test()
Dim strtemp
strtemp ="SCR0334535 @ 0.01µM"
Debug.Print Mid(strtemp, InStr(strtemp, "@") + 1)
End Sub

Regards,

Jean-Yves

"Dr. Schwartz" wrote in message
...
I have a string value that varies in length. The first 13 characters I am

not interested in, but the last part I'm interested in extracting. Here is a
data example:

SCR0334535 @ 0.01µM
SCR0334535 @ 0.03µM
SCR0334535 @ 0.1µM
SCR0334535 @ 0.3µM
SCR0334535 @ 1µM
SCR0334535 @ 3µM
SCR0334535 @ 10µM
SCR0334535 @ 30µM
SCR0334535 @ 100µM

How can I get the last part (character 14 and onwards) assigned to a new

variable?

Thank you





All times are GMT +1. The time now is 01:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com