sedano

Populating field based on another field containing numbers and text

Discussion created by sedano on Jan 30, 2014
Latest reply on Jan 30, 2014 by rfairhur24
Hi all, I wrote a month ago with a question on using the field calculator to populate a new field based on numbers from another field (specifically zoning use codes to create zoning category names), and with the community's help I solved it -- but now it seems to have gotten more calculated. Before I was able to use a vbscript code that was a longer version of this:
IF [USE_CDE] >= 0100 and [USE_CDE] <= 0999 then
Output = "Residential"
ElseIF [USE_CDE] >= 1000 and [USE_CDE] <= 2999 then
Output = "Commercial"
ElseIF [USE_CDE] >= 3000 and [USE_CDE] <= 3999 then
Output = "Industrial"
End IF

Now I'm using a different parcel dataset, and I want to do the same thing, except the use code contain a mix of numbers and letters: i.e. 1010, 101B, 101T, 2000, 200G, etc. etc.

I've tried creating a codeblock like:
IF [USE_CDE] >= 0100 and [USE_CDE] <= 0999 then
Output = "Residential"
ElseIF [USE_CDE] >= 1000 and [USE_CDE] <= 2999 then
Output = "Commercial"
ElseIF [USE_CDE] = 010C then
Output = "Residential"
ElseIF [USE_CDE] = 010D then
Output = "Residential"
End IF

so specifically listing out each code that contains numbers. But no luck. The geoprocessing results window is telling me it is expecting a "then" which makes me think it gets to the letter in a code and things it should be a then. But I don't know. I'm not even sure if I can use the field calculator to search for terms that include letters.

Any ideas are most appreciated! Thank you!

Outcomes