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),"<>"))
![enter image description here](https://i.stack.imgur.com/WYk5M.png)
Another option is SUBTOTAL and OFFSET:
=SUM(SUBTOTAL(4,OFFSET(B2:E2,SEQUENCE(9,,0),0,1,4)))
![enter image description here](https://i.stack.imgur.com/mI4T6.png)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…