发布网友 发布时间:2022-02-23 01:02
共1个回答
热心网友 时间:2022-02-23 02:32
'自定义公式-按ALT+F11-插入-模块-粘贴代码-表格另存为启用宏的格式
Function 统计(a As Range, b As String)
Dim i As Integer
For i = 1 To a.Columns.Count
If a.Cells(1, i) = "" Then GoTo l
If i Mod 2 = 1 Then
If a.Cells(1, i) = b Then t = t + a.Cells(1, i + 1)
End If
l:
Next
统计 = t
If 统计 = 0 Then 统计 = ""
End Function