I am trying to create a field calculation in a field to only display a range of numbers, using vb script and the pre-logic script code block. This is what I have so far

Dim x

if [Round_UPFT] <=1 then x = '0-1'

elseif [Round_UPFT] >=2 and [Round_UPFT] <=4 then x = '2-4'

elseif [Round_UPFT] >=5 and [Round_UPFT] <=20 then x = '5-20'

elseif [Round_UPFT] >=21 and [Round_UPFT] <=40 then x = '21-40'

end if

Ranges= x

i get a general error code too : 999999

and a syntax error as well.

I'm under the assumption that the AND function is messing the syntax up, but im such a newbie at this I dunno!

I think the problem is the "x = ..." needs to be on a separate line.

However, you can simplify this code like this