Этот код в VBA сделает это:
Public Sub ReqandAppr()
'****************
' variables
SourceSheet = "Sheet1" 'name of source sheet
DestSheet = "Sheet2" ' name of destination sheet
columntocheck = 5 'Column to check "Requested" or "Approved"
firstrow = 2 'first row in source sheet
destrow = 1 'first row in destination sheet
'end of variables
'*******************
Dim wkb As Workbook
Dim wksSource, wksDest As Worksheet
Set wkb = ThisWorkbook
Set wkSource = wkb.Sheets(SourceSheet)
Set wkDest = wkb.Sheets(DestSheet)
wkDest.Rows.Clear
totalrows = wkSource.Cells(Rows.Count, 1).End(xlUp).Row
For i = firstrow To totalrows
If wkSource.Cells(i, 1) <> wkSource.Cells(i - 1, 1) Then
requestedfound = False
approvedfound = False
End If
Select Case wkSource.Cells(i, columntocheck)
Case "Requested"
If requestedfound = False Then
wkSource.Rows(i).Copy Destination:=wkDest.range("A" & destrow)
requestedfound = True
destrow = destrow + 1
End If
Case "Approved"
If approvedfound = False And wkSource.Cells(i, columntocheck - 1) = 0 Then
wkSource.Rows(i).Copy Destination:=wkDest.range("A" & destrow)
approvedfound = True
destrow = destrow + 1
End If
End Select
Next i
End Sub
Откройте VBA/MAcros с помощью ALT+F11, в ThisWorkbook вставьте новый модуль и вставьте код с правой стороны.
Проверьте значение переменных и выполните его.