I'm trying to use field calculator to compare two fields in a table of tax parcel data, Land Value (LAND_VAL) and Improvement Value (IMPRVT_VAL). My goal is to determine (1) Parcels with land value less than the value of improvements, (2)Land value about the same value as improvements, (3) Land value more than improvement value, but less than twice the value, and (4) Land value which is more than twice improvement value.
I wrote the following script, and it runs successfully in Field Calculator (doesn't give any errors), but it only returns 4, which is clearly not the case in the data.
LV = " !LAND_VAL! " IV = " !IMPRVT_VAL! " def Recode(Val_Analys): if LV < IV: return 1 elif LV == IV: return 2 elif (LV > IV and LV < (IV * 2)): return 3 elif LV > (IV * 2) : return 4 else: return 0 Recode(!Val_Analys!)