Excel IsNumeric Function: Determine if Values are Numeric | Excel Help
Your Programming and Traning Professionals

Excel IsNumeric Function: Determine if Values are Numeric


The IsNumericExcel Function is used to determine whether or not a specific value is a numerical value or not. The IsNumericfunction also returns a Boolean value (True or False).

The Basics:

True/False = IsNumeric(ValueToBeEvaluated)

Now. let us look at an example. Let’s assume that we want to parse a block of data and extract all numerical values and write the values out to a spreadsheet. The IsNumericfunction be our tool to achieve this.

Code

'Declare variables
Dim StringToProcess As String   'Variable string to process
Dim arrValues() As String       'String Array
Dim A, B As Long                  'Value to use as a counter
Dim tmpValue As Variant
Dim Check As Boolean
StringToProcess = ActiveSheet.Cells(2, 1).Value 'Assign the information to process to our variable
arrValues() = Split(StringToProcess, " ") 'Parse the string into a string array using a space delimiter
Counter = 5
For A = LBound(arrValues) To UBound(arrValues)
	Check = IsNumeric(arrValues(A))
	If Check Then
		ActiveSheet.Cells(Counter, 1).Value = CDbl(arrValues(A))
		Counter = Counter + 1
	End If
Next

Output