firstCell = cel.Offset(-i, 0).Row
这包括
SUM
作用
(25%=0.25,这就是为什么你得到了.75)
请改用以下内容:
Function SumAbove(cell As Range) As Double
Dim firstCell As Long
Dim i As Integer
firstCell = cell.Row
While Not cell.Offset((cell.Row - firstCell) * -1, 0).NumberFormat = "0.00%"
firstCell = firstCell - 1
Wend
SumAbove = WorksheetFunction.Sum(Range(Cells(firstCell + 1, cell.Column), cell))
End Function