求められている関数ではありませんが、VBAでの回答です。
(初心者のコードなので不具合あればご理解ください。)
Option Explicit
Sub FindLastColoredCells()
Dim i As Long
Dim lastCol As Long
Dim pinkLast As Long
Dim blueLast As Long
Dim aquaLast As Long
' 1行目の最後の列を探す
lastCol = Cells(1, Columns.Count).End(xlToLeft).Column
' ピンク色の最後のセルを探す
For i = 2 To lastCol
If Cells(2, i).Interior.ColorIndex = 7 Then
pinkLast = i
End If
Next i
' 水色の最後のセルを見つける
For i = 2 To lastCol
If Cells(2, i).Interior.ColorIndex = 8 Then
aquaLast = i
End If
Next i
' 青色の最後のセルを見つける
For i = 2 To lastCol
If Cells(2, i).Interior.ColorIndex = 11 Then
blueLast = i
End If
Next i
' 結果を出力
Range("M1") = Range("B1")
Cells(1, 14).Value = Cells(1, pinkLast).Value
Cells(1, 15).Value = Cells(1, pinkLast).Value
Cells(1, 16).Value = Cells(1, aquaLast).Value
Cells(1, 17).Value = Cells(1, aquaLast).Value
Cells(1, 18).Value = Cells(1, blueLast).Value
Range("M1:R1").NumberFormatLocal = "h:mm"
End Sub
お礼
できました!ありがとうございます。