F17 is probably treated as a text value and as such excel will deem it to be > than any number - do you have formulas in column F returning those values?

You can try converting to a number within the formula like this

=IF(F17+0<365,......