# Calculate empty field with 3 text classes based on another integer field

133
2
08-30-2017 12:59 PM
Highlighted
New Contributor II

I am a beginner, I have no knowledge in coding and Python script but I need to do something that requires it.

I have an empty column which needs to be filled with three possible classes: easy, medium, difficult based on the values from another column.

So how to write the syntax in the Field Calculator where "easy" would contain values from 0-10, "medium" would contain values from 10-20 and "difficult" would contain values from 20-40 ?

1 Solution

Accepted Solutions
Highlighted
Honored Contributor

As a beginner, you could just use Select by Attributes followed by Field Calculator (for the selected features).

Expression 1 (Select by Attributes)

"Avg_Slope" < 10

Expression 1 (Field Calculator)for tehzina

"Easy"

Expression 2 (Select by Attributes)

"Avg_Slope" >= 10 AND "Avg_Slope" < 20

Expression 2 (Field Calculator)for tehzina

"Medium"

Expression 3 (Select by Attributes)

"Avg_Slope" > 20

Expression 3 (Field Calculator)for tehzina

"Difficult"

2 Replies
Highlighted
Honored Contributor

As a beginner, you could just use Select by Attributes followed by Field Calculator (for the selected features).

Expression 1 (Select by Attributes)

"Avg_Slope" < 10

Expression 1 (Field Calculator)for tehzina

"Easy"

Expression 2 (Select by Attributes)

"Avg_Slope" >= 10 AND "Avg_Slope" < 20

Expression 2 (Field Calculator)for tehzina

"Medium"

Expression 3 (Select by Attributes)

"Avg_Slope" > 20

Expression 3 (Field Calculator)for tehzina

"Difficult"

Highlighted
New Contributor II

Thanks! I guess I've been focusing on codes and I've forgotten how simple it can be  I realized I could have just sorted the Avg Slopes by Ascending and select the desired rows and rename them with the Field Calc.