Check if cell value is a number using IsNumeric

YasserKhalil
PlatinumLounger
Posts: 4913
Joined: 31 Aug 2016, 09:02

Check if cell value is a number using IsNumeric

Post by YasserKhalil »

Hello everyone
I have a value in a cell like that
1,,6
And in the code I have used

Code: Select all

If Not IsNumeric(c) Or IsEmpty(c) Then
It seems the value is like a number but as for me is not a valid number
How can I skip that problem?
Simply this value shouldn't return True as this is not a real and valid number for me ..

YasserKhalil
PlatinumLounger
Posts: 4913
Joined: 31 Aug 2016, 09:02

Re: Check if cell value is a number using IsNumeric

Post by YasserKhalil »

I have solved it using this line (Evaluate)

Code: Select all

If IsError(Evaluate("" & c.Value & " * 1")) Or IsEmpty(c) Then
But I welcome any suggestions.

User avatar
HansV
Administrator
Posts: 78470
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Check if cell value is a number using IsNumeric

Post by HansV »

You might also use

Code: Select all

If Not Application.IsNumber(c) Or IsEmpty(c) Then
but I haven't tested it extensively.
Best wishes,
Hans

YasserKhalil
PlatinumLounger
Posts: 4913
Joined: 31 Aug 2016, 09:02

Re: Check if cell value is a number using IsNumeric

Post by YasserKhalil »

An amazing trick my tutor. Thanks a lot.

User avatar
Doc.AElstein
BronzeLounger
Posts: 1499
Joined: 28 Feb 2015, 13:11
Location: Hof, Bayern, Germany

Re: Check if cell value is a number using IsNumeric

Post by Doc.AElstein »

Here are some UDF ideas from Rick Rothstein
I am having difficulty logging in with this account just now.
You can find me at DocAElstein also

YasserKhalil
PlatinumLounger
Posts: 4913
Joined: 31 Aug 2016, 09:02

Re: Check if cell value is a number using IsNumeric

Post by YasserKhalil »

Thanks a lot, Mr. Alan

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

Re: Check if cell value is a number using IsNumeric

Post by LisaGreen »

Doc.AElstein wrote:
23 Mar 2021, 18:39
Here are some UDF ideas from Rick Rothstein
Great thread Alan!

Lisa