Find

K

KK

123FF+,456 ,789FF+ (Text format )

How can i find the "FF" and return the number before "FF" ?I had try to use
Find method in excel, but it only can help me to find out first "FF".
 
S

Stefi

Or, if you want it as a VBA line:
?MID(range("A1"),instr(1,range("A1"),"FF")-1,1)

Regards,
Stefi
 
K

KK

Hi Stefi ,

Thanks for your help !!!^^
But if i would like save the two value into 2 variable , is it possible ?
and have any function to count how many "FF" in a cell?
 
S

Stefi

Number off FFs:
NoOfFF = Len(Range("A1")) - Len(Replace(Range("A1"), "FF", "")) / 2

Do you mean that var1 should be 123, var2 should be 789? If so, are these
substrings always 3 character long? Do you want the variables be strings os
numbers?

Stefi


„KK†ezt írta:
 
K

KK

Ya , i would like to save variable a as 123 , and variable b as 789 .But the
string no always 3 character long , sometime will be 2 or one , but each
123FF,456,789FF is divide by a comma.
 
S

Stefi

Sub test()
NoOfFF = Len(Range("A1")) - Len(Replace(Range("A1"), "FF", "")) / 2
FFpos1 = InStr(1, Range("A1"), "FF")
var_a = Val(Mid(Range("A1"), 1, FFpos1 - 1))
FFpos2 = InStr(FFpos1 + 2, Range("A1"), "FF")
commapos = InStrRev(Range("A1"), ",", FFpos2)
var_b = Val(Mid(Range("A1"), commapos + 1, FFpos2 - commapos - 1))
End Sub

Regards,
Stefi


„KK†ezt írta:
 
K

KK

Thanks a lot !!!Stefi you been great help !!

KK

Stefi said:
Sub test()
NoOfFF = Len(Range("A1")) - Len(Replace(Range("A1"), "FF", "")) / 2
FFpos1 = InStr(1, Range("A1"), "FF")
var_a = Val(Mid(Range("A1"), 1, FFpos1 - 1))
FFpos2 = InStr(FFpos1 + 2, Range("A1"), "FF")
commapos = InStrRev(Range("A1"), ",", FFpos2)
var_b = Val(Mid(Range("A1"), commapos + 1, FFpos2 - commapos - 1))
End Sub

Regards,
Stefi


„KK†ezt írta:
 
Top