henry220,

If I understand your request, the following formula should work for you:

=IF(C6>=513,512,C6)

If C6 is 512 or less, D6 will display the number located in C6. If C6 is 513 or higher, D6 will display 512.

Thanks,
Cirenav