Isnumeric('07213E71') = True

ISNUMERIC('07213E71') = True?

07213E71 is a floating number 7213 with 71 zeros

You can use this ISNUMERIC(myValue + '.0e0') to test for whole integers. Slightly cryptic but works.

Another test is the double negative myValue NOT LIKE '%[^0-9]%' which allows only digits 0 to 9.

ISNUMERIC has other issues in that these all return 1: +, -,

SQL IsNumeric Returns True but SQL Reports 'Conversion Failed'

You need to replace comma with a period:

CAST(REPLACE(column, ',', '.') AS FLOAT)

SQL Server outputs decimal separator defined with locale, but does not unterstand anything but a period in CASTs to numeric types.

StringUtils isNumeric returns true when input is ???, why?

I was able to find the answer to this question by looking at the StringUtils source code for the isNumeric method.
In the source code that line appears as:

StringUtils.isNumeric("\u0967\u0968\u0969")  = true

Where u0967, u0968, u0969 are Devangari Digits one, two, and three respectively.
This may be a browser issue causing the characters to not be rendered correctly in the API.

IsNumeric returns true for strings containing a D character

If you check the VB6 docs:

Note Floating-point values can be expressed as mmmEeee or mmmDeee, in which mmm is the mantissa and eee is the exponent (a power of 10). The highest positive value of a Single data type is 3.402823E+38, or 3.4 times 10 to the 38th power; the highest positive value of a Double data type is 1.79769313486232D+308, or about 1.8 times 10 to the 308th power. Using D to separate the mantissa and exponent in a numeric literal causes the value to be treated as a Double data type. Likewise, using E in the same fashion treats the value as a Single data type.

IsNumeric function returning true for an empty cell

There are cases where it is better to check the length of the characters inside cells instead of using the isNumeric(), or check for errors etc...

For example try the below code

it establishes the Range used in the active worksheet then iterates through checking the length (len()) of each cell

you can look at Immediate Window CTRL+G in VBE to see which cell addresses are empty or wait until the macro finishes executing and you will be welcomed with a Message Box saying how many empty cells are within the range

Option Explicit

Sub CheckForEmptyCells()

Dim lastCol As Range
Set lastCol = ActiveSheet.Cells.Find(What:="*", After:=ActiveSheet.Cells(1, 1), LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious, MatchCase:=False)

Dim rng As Range
Set rng = Range("A1:" & lastCol.Address)

Dim cnt As Long
cnt = 0

Dim cell As Range
For Each cell In rng
If Len(cell) < 1 Then
Debug.Print cell.Address
cnt = cnt + 1
End If
Next

MsgBox "there are " & cnt & " empty cells within the range " & rng.Address
End Sub

finished



Related Topics



Leave a reply



Submit