Le celle non hanno .value, pertanto per if di confronto con là variabile max o usi .text oppure innerHTML