NE2
=MAX(SUBTOTAL(9,OFFSET(D2,0,COLUMN(D2:NB2)-COLUMN(D2),1,3)))
TRY THIS ARRAY FORMULA and copy towards down
since it is an array formula please confirm it with Ctrl+Shift+Enter