Hello,
Sometimes I need to extract prices from cell contents. The problem is that some people leave some empty spaces or words in cell, so I can't calculate with these values.
So, I may have "15,44" or " 15,44 " or "price 15,44" or a mix of it.
There are some solutions and formulas to extract numbers from a cell, like this one:
but it ignores decimal values separator. In my country it's "," (comma) if it matters.
Therefore, all solutions I tried so far would give me "1544" as a price (instead of 15,44) from example problematic cells.
What else can I try?
Thank you in advance for all your help!
Sometimes I need to extract prices from cell contents. The problem is that some people leave some empty spaces or words in cell, so I can't calculate with these values.
So, I may have "15,44" or " 15,44 " or "price 15,44" or a mix of it.
There are some solutions and formulas to extract numbers from a cell, like this one:
VBA Code:
Public Function GetNumericValue(range)
Set myRegExp = New RegExp
myRegExp.IgnoreCase = True
myRegExp.Global = True
myRegExp.Pattern = "[\D]"
GetNumericValue = myRegExp.Replace(range.Value, "")
End Function
Therefore, all solutions I tried so far would give me "1544" as a price (instead of 15,44) from example problematic cells.
What else can I try?
Thank you in advance for all your help!