答案 0 :(得分:1)
F3将是:
=IF(LEN(F3),INDEX(B:B,MATCH(F3,A:A,0)),"")
和G3:
Listener.onListEndReached()
将F3:G3复制到H3:I3和"自动填充"根据需要
答案 1 :(得分:0)
如果您想使用宏,那么只需将此代码复制到Visual Basic编辑器中的模块中并运行它。
Sub insertRows()
Columns("G:J").EntireColumn.Delete
Dim lrow As Long: lrow = Range("A" & Rows.Count).End(xlUp).Row
Dim brng As Range: Set brng = Range("A1:D" & lrow)
brng.Copy Range("G1"): Range("G1").Value = "After"
Dim arng As Range: Set arng = Range("G3:G" & lrow)
Dim rng As Range
For Each rng In arng
If rng <> rng.Offset(, 2) Then
If rng > rng.Offset(, 2) Then
rng.Resize(, 2).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Else
rng.Offset(, 2).Resize(, 2).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End If
End If
Next rng
End Sub
答案 2 :(得分:0)
来自cell F3
:
=IF(AND(N(F2)=0,F2<>""),1,IF(AND(NOT(COUNTIF($A$3:$A$22,MIN(INDEX($A$3:$A$22,MATCH(MAX(F$2:F2,H$2:H2),$A$3:$A$22,1)+1),INDEX($C$3:$C$22,MATCH(MAX(F$2:F2,H$2:H2),$C$3:$C$22,1)+1)))),INDEX($A$3:$A$22,MATCH(MAX(F$2:F2,H$2:H2),$A$3:$A$22,1)+1)),"",INDEX($A$3:$A$22,MATCH(MAX(F$2:F2,H$2:H2),$A$3:$A$22,1)+1)))
来自cell G3
:
=IF(N(F3),INDEX(B:B,MATCH(F3,A:A,0)),"")
来自cell H3
:
=IF(AND(N(H2)=0,H2<>""),1,IF(AND(NOT(COUNTIF($C$3:$C$22,MIN(INDEX($C$3:$C$22,MATCH(MAX(H$2:H2,F$2:F2),$C$3:$C$22,1)+1),INDEX($A$3:$A$22,MATCH(MAX(H$2:H2,F$2:F2),$A$3:$A$22,1)+1)))),INDEX($C$3:$C$22,MATCH(MAX(H$2:H2,F$2:F2),$C$3:$C$22,1)+1)),"",INDEX($C$3:$C$22,MATCH(MAX(H$2:H2,F$2:F2),$C$3:$C$22,1)+1)))
来自cell I3
:
=IF(N(H3),INDEX(D:D,MATCH(H3,C:C,0)),"")
基本上,公式在Debit
和Credit
列下非常相似,但只是交换范围引用。试着让我知道。