I have a database field called numdat that gives me numbers as STRINGS from 1-11

I would like to group by numdat but exclude 9,10,11 from the grouping.

I can't use the Select Expert because I need to use 9,10,11 elsewhere in the report(outside of the group)

how do I get this done?

P.S. I tried

if (tonumber({Command.numdat})) < 9
then (tonumber({Command.numdat}))
as the group formula but the '9' row still shows up