需要采用VBA
这个VBA是需要递归调用的
Public j!, s$, k As Boolean
Function mbCount(ByVal T As String) As Integer
If Not k Then
mbCount = 0: j = 1: s = T: k = True
End If
Dim i As Integer
With ActiveSheet
For i = 2 To .[A65536].End(xlUp).Row
If Cells(i, 1) = T Then
j = j + 1
x = mbCount(Cells(i, 2))
End If
Next
End With
If s = T Then k = False: mbCount = j
End Function
用自定义函数
=mbCount(v)
v:指定推荐者或含有推荐者的名字的单元格
效果如图:
附件请下载参考
很好。递归。