I have a custom column that does a similar thing with the following code in it:
Code:
program:
words=raw_field('#words');
shelf_name=cmp(words, 7500, 'Short Story', 'Novelette', 'Novelette');
shelf_name=cmp(words, 17500, shelf_name, 'Novella', 'Novella');
shelf_name=cmp(words, 40000, shelf_name, 'Novel', 'Novel');
The "cmp" lines compare the value of "words" with the number and return the first value if there are less words, the second if the are the same and third if there more.
You can change the word count to test against and the text to be used to match what you want. As you have four ranges, you will want to add an extra line.