View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default extract number from a cell

Hi again,

Am Wed, 14 Jun 2017 17:18:21 +0200 schrieb Claus Busch:

try in B1:
=LOOKUP(9^9,1*RIGHT(MID(A1,1,FIND(" ",A1)-1),COLUMN(A1:IQ1)))


or do it with an UDF:

Function myPrice(myRng As Range) As Double
Dim varData As Variant
Dim re As Object
Dim ptrn As String

Set re = CreateObject("vbscript.regexp")
ptrn = "[a-z] {0,}"
re.Pattern = ptrn
re.IgnoreCase = True
re.Global = True
varData = Split(myRng, " ")
myPrice = re.Replace(varData(0), "")

End Function

and call that function in the sheet with e.g.
=myPrice(A1)


Regards
Claus B.
--
Windows10
Office 2016