Yes certainly, Your solution will work very well:
=IF(B1=0,0,MAX((B1<4)*(12-B1*2)+(B1>=4)*(9-B1),0))
Or if you want to use DNF in place to the zero then:
=IF(B1="DNF",0,MAX((B1<4)*(12-B1*2)+(B1>=4)*(9-B1),0))
Or if you want to use either:
=IF(OR(B1="DNF",B1=0),0,MAX((B1<4)*(12-B1*2)+(B1>=4)*(9-B1),0))
Or even if you want to enter various different text messages:
=IF(ISTEXT(B1),0,MAX((B1<4)*(12-B1*2)+(B1>=4)*(9-B1),0))

Signature
HTH
Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings
sandymann2@mailinator.com
Replace@mailinator.com with @tiscali.co.uk
>> Yes, that's because I tested one formula and posted another, (don't ask
>> me how I did it!)
[quoted text clipped - 15 lines]
> =IF function into your equation?
> ie. IF(B1=0, 0) or something?