extract text

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

if i have different text strings, but in all of them there will by a dollar amount

example:
aif2ffsdfij$39.99&3kgjcis
o
qe141$29.99.cw.e.331

how would i go about extracting the formul
 
Do you mean the amount?

=MID(A1,FIND("$",A1),FIND(".",A1)+2-FIND("$",A1)+1)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Are you looking for something like this?

Sub test()
MsgBox cash$("aif2ffsdfij$39.99&3kgjcism")
MsgBox cash$("qe141$29.99.cw.e.3312")
End Sub

Function cash$(s$)
Dim pos1%, pos2%
pos1% = InStr(1, s$, "$")
pos2% = InStr(pos1%, s$, ".")
cash$ = Mid$(s$, pos1%, pos2% + 3 - pos1%)
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top