MAX accepts arrays as entry so it will see all the returns before finding the max.
We can use MAXIFS and OFFSET to create an array of outputs line by line:
=SUM(MAXIFS(OFFSET(B2:E2,SEQUENCE(9,,0),0,1,4),OFFSET(B2:E2,SEQUENCE(9,,0),0,1,4),"<>"))
Another option is SUBTOTAL and OFFSET:
=SUM(SUBTOTAL(4,OFFSET(B2:E2,SEQUENCE(9,,0),0,1,4)))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…