Select to view content in your preferred language

"FLOOR" numeric function in Field Calculator

1127
3
06-20-2012 02:43 AM
PaulineAmez
New Contributor
Hi,
I???ve encountered some difficulties to enter the ???FLOOR??? numeric function into the Field Calculator. I???m guessing my syntax is wrong but don???t know which part is wrong (e.g. a misplaced bracket, something missing, etc.)? Here is what I wrote in the field calculator: Floor ([ELEVATION], 5). The message I received is ???There was a failure during processing, check the Geoprocessing Results window for details.??? I did check and I found the ERROR 999999 and the type mismatch: ???Floor???. Does anyone know how to write this function correctly?
Cheers.
Tags (2)
0 Kudos
3 Replies
MarcinGasior
Frequent Contributor
There's no Floor() function in VBScript. (refer to Functions (VBScript) reference)

You can use Int() or preferably Fix() functions instead which work like this:

MyNumber = Int(99.8)    ' Returns 99.
MyNumber = Fix(99.2)    ' Returns 99.
MyNumber = Int(-99.8)   ' Returns -100.
MyNumber = Fix(-99.8)   ' Returns -99.
MyNumber = Int(-99.2)   ' Returns -100.
MyNumber = Fix(-99.2)   ' Returns -99.
0 Kudos
DarrenWiens2
MVP Alum
If you want to use floor in the field calculator, select the Python parser, and use the expression:
math.floor(!Elevation!)
0 Kudos
PaulineAmez
New Contributor
Thanks a lot for your answers and apologies for this belated reply, got some troubles with my account. All is working well!
Cheers 🙂
0 Kudos