The challenge I have is to

Precondition:

Any ideas for the easiest approach? Maybe do all the calculations outside ARcGIS in a database and then feed the field with the new value?

Thanks,

Sergio

**calculate a new value for one of the field columns of the attribute table**of a normal polygon layer.Precondition:

**use a formula from an Excel spredsheet which works utilizing lookup tables**(data for the formula).Any ideas for the easiest approach? Maybe do all the calculations outside ARcGIS in a database and then feed the field with the new value?

Thanks,

Sergio

That said, without dissecting the whole thing I mostly see how it works and i think you can do this with using dictionaries that have multiple values per key.. .so just the first row of your removal data would look like this in a dictionary:

and so this part of your excel formula:

'$J$29*(VLOOKUP($J$28,RemovalData,3,0))'

could be implemented by getting a value from a dictionary based on the key reference. To do this, first make a function to get a value from the dictionary above, the arguments are the dictionary name, the key you're interested in and the index of the column holding the data you want. Remember in excel the column indexes are 1 based but in python indexes are 0 based, so your column references will always be 1 less than in excel

In this example value for $J$29 is variable J29, and variable for $J$28 is J28 - then in the formula this would be implmented by:

Ultimately it looks like you need to handle the following inputs to the formula:

a variable to contain the data Column B (B2 for instance)

A dictionary with multiple key values for Removal Data

A dictionary with multiple key values for Manure Data

a variable to contain the value for PTarget

Beyond that, there are multiple nested If/elif/else type statements and some basic mathmatical operations. Complex mostly in the nesting of the If/elif/else and the use of the lookups, but very doable I think.