Take row 4
=IFERROR(INDEX(A4:F4,AGGREGATE(14,6,(COLUMN(A4:F4)-COLUMN(A4)+1)/(A4:F4<>""),2)),"N/A")
Blue part makes an array of column numbers {1,2,3,4,5,6}
Red part makes an array of True/False values {T,T,F,T,F,T}
=IFERROR(INDEX(A4:F4,AGGREGATE(14,6,({1,2,3,4,5,6})/({T,T,F,T,F,T}),2)),"N/A")
When doing the arithmetic of blue divided by red, T = 1 and F = 0 so the results array is
{1,2,#DIV/0!,4,#DIV/0!,6}
AGGREGATE(14,6,.....,2) says to take the second highest value ignoring errors = 4
INDEX then retrieves the value from the 4th cell in A4:F4. This is 9 from D4.