Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Strings and numbers in cells
Is there a way to make Excel only recognise numbers in a cell when the cell
contains both numbers and a string? lespal |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Strings and numbers in cells
The following UDF might do what you want it to. It loops through a string
value and concatenates numeric strings and returns the result as a long integer. Function ReturnNums(StringVal) As Long Dim intLen As Integer Dim i As Integer Dim strReturnVal As String Dim strChar As String intLen = Len(StringVal) For i = 1 To intLen strChar = Mid(StringVal, i, 1) If IsNumeric(strChar) Then strReturnVal = strReturnVal & strChar Next i If Len(strReturnVal) = 0 Then ReturnNums = 0 Else ReturnNums = CLng(strReturnVal) End If End Function -- Kevin Backmann "lespal" wrote: Is there a way to make Excel only recognise numbers in a cell when the cell contains both numbers and a string? lespal |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I total just the numbers in a column and ignore non-numeric strings? | Excel Worksheet Functions | |||
how to extract decimal numbers from alphanumeric strings in Excel | Excel Discussion (Misc queries) | |||
How to find number of pairs of strings from list of strings? | Excel Worksheet Functions | |||
2 more questions about extracting numbers from text strings | Excel Discussion (Misc queries) | |||
Extract numbers from strings | Excel Worksheet Functions |