Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check if cell value is an integer

Tags:

excel

vba

I would like to check if a value of a cell is an integer (number without comma) or decimal (number with comma). I tried:

1.)

IsNumeric(.Cells(row, column).Value)

-> true also for decimal

2.)

IsNumeric(CInt(.Cells(row, column).Value))

-> Types incompatiple

3.)

If CInt(.Cells(row, column).Value) / .Cells(row, column).Value = 1 

-> Types incompatiple

like image 797
erik-stengel Avatar asked Sep 16 '25 00:09

erik-stengel


1 Answers

The MOD() function like this:

=MOD(A1,1)

will return 0 if integer and a value greater than 0 if the number has a decimal.

like image 197
Solar Mike Avatar answered Sep 19 '25 03:09

Solar Mike